Passing new props to react-native-router-flux -
i have redux store , router scenes. i'm implementing kind of authentication, activity indicator , messages. problem i'm facing here every time send new props through redux router error "cannot update during existing state transition". tried few ways how handle no luck.
routes.js
... class routes extends component { render() { return ( <connectedrouter {...this.props}> <scene key="lightbox" lightbox> <scene key="modal" modal hidenavbar> <scene key="root"> <scene key="login" component={loginscene} title="login" type={'reset'} initial={true} hidenavbar={true} /> <scene key="home" component={homescene} title="home" type={'reset'} /> </scene> </scene> <scene key="sendingrequest" component={activityindicator}/> </scene> </connectedrouter> ); } } const mapstatetoprops = (state) => { return { user: { token: state.auth.token }, sendingrequest: state.helpers.sendingrequest } }; export default connect(mapstatetoprops, {})(routes); if try login , dispatch sendingrequest , token successful login, error:
warning: cannot update during existing state transition (such within
renderor component's constructor). render methods should pure function of props , state; constructor side-effects anti-pattern, can movedcomponentwillmount.
how should implement this? planning componentwillreceiveprops check sendingrequest props , show/hide activity indicator , user.token.
thanks!
Comments
Post a Comment