Skip to content

Instantly share code, notes, and snippets.

@gcazaciuc
Last active September 19, 2017 15:43
Show Gist options
  • Save gcazaciuc/4b9a8daf08f3ff31a3b329287e6178bf to your computer and use it in GitHub Desktop.
Save gcazaciuc/4b9a8daf08f3ff31a3b329287e6178bf to your computer and use it in GitHub Desktop.
Redux connect as a function child component
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