Last active
September 19, 2017 15:43
-
-
Save gcazaciuc/4b9a8daf08f3ff31a3b329287e6178bf to your computer and use it in GitHub Desktop.
Redux connect as a function child component
This file contains 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 { getUser } from 'selectors/UserSelectors.js'; | |
import { deleteUser } from 'actions/UserActions.js'; | |
export const App = (props) => | |
( <Connect> | |
(state, dispatch) => { | |
const user = getUser(state); // There is no need for mapStateToProps. Just transform the data and pass it | |
return (<Component | |
user={user} | |
onDeleteUser={(user) => dispatch(deleteUser(user))} /> | |
) | |
} | |
</Connect> | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment