Open gocreating opened 7 years ago
How can I receive props from parent component (actually from redux store's connect HOC) inside Transmit.createContainer?
props
connect
Transmit.createContainer
Given a scenario like below:
// UserList.js class UserList extends Component { render () { return this.props.users.map(/* ... */); } } export default Transmit.createContainer(UserList, { /* how to receive props (page, dispatch, foo, bar, ...etc.) here? */ fragments: { users (queryParams) { return () => userAPI.list({ page: pageFromProps, // fetch data depending on props }).then(users => { dispatchFromProps(receiveUsers(users)); // dispatch action creator to update store return users; }); }, }, });
// MainPage.js class MainPage extends Component { render() { return ( <div> <UserList page={3} dispatch={reduxStore.dispatch} foo={reduxStore.getState().foo} bar={reduxStore.getState().bar} /> </div> ); } }
How can I receive
props
from parent component (actually from redux store'sconnect
HOC) insideTransmit.createContainer
?Given a scenario like below: