Created
May 16, 2018 11:01
-
-
Save SevenOutman/6fda70a4abe24792952b4aa2b893925a to your computer and use it in GitHub Desktop.
Use redux like React 16.3 Context API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { connect } from 'react-redux'; | |
export default connect( | |
state => ({ state }), // mapState2Props | |
)( | |
({ state, dispatch, children }) => children(state, dispatch), // <Store> component | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default () => ( | |
<Store> | |
{state => ( | |
<Table data={state.users} /> | |
)} | |
</Store> | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment