How do I use local state along with redux store state in the same react component?

后端 未结 3 496
甜味超标
甜味超标 2020-12-30 03:16

I have a table that displays contacts and I want to sort the contacts by first name. The contacts array comes from the redux store, which will come then come through the pro

3条回答
  •  既然无缘
    2020-12-30 03:43

    React 16.3 includes a static function getDerivedStateFromProps(nextProps, prevState), which will be invoked after initial mount as well as when it receives new props. See https://reactjs.org/docs/react-component.html#static-getderivedstatefromprops

提交回复
热议问题