Closed js2me closed 6 years ago
Its possible? Hello, I use this react-router-modal as route component of my user info modal and I have problem with connecting my component with redux. Here is my User Container code which connects as route component to ModalRoute:
ModalRoute
export namespace User { export interface Props extends RouteComponentProps<void> { user: UserStoreState; actions: typeof UserActions; } } @connect(mapStateToProps, mapDispatchToProps) export default class User extends React.Component<User.Props>{ constructor(props){ super(props); } render(){ console.log(this.props.user); return ( <div className='modal user'> <label className="user-name">LOL</label> <button className="close-modal-button"> <span className='button-bar'/> <span className='button-bar'/> </button> </div> ) } } function mapStateToProps(state){ return { user: state.user } } function mapDispatchToProps(dispatch){ return { actions: bindActionCreators(UserActions as any, dispatch) } }
Displays to console: undefined...
undefined
And there I wrote ModalRoute and ModalContainer
ModalContainer
<ModalRoute className='user-modal' path="/user/:userId" parentPath='/search?query=Mankubus' component={() => <AsyncComponent moduleProvider={user}/>}/> <ModalContainer history={history}/>
If you will talk about AsyncComponent , its worked with my others routes :)
AsyncComponent
<Route path="/game" component={() => <AsyncComponent moduleProvider={playground}/>}> </Route> <Route path="/search" component={() => <AsyncComponent moduleProvider={search}/>}> </Route>
And sorry for my bad english ))
OMG, sorry sorry ITS MY PROBLEM, Im so stupid ahahah, I forgot combine user reducer with other reducers in reducers/index.ts
reducers/index.ts
Its possible? Hello, I use this react-router-modal as route component of my user info modal and I have problem with connecting my component with redux. Here is my User Container code which connects as route component to
ModalRoute
:Displays to console:
undefined
...And there I wrote
ModalRoute
andModalContainer
If you will talk about
AsyncComponent
, its worked with my others routes :)And sorry for my bad english ))