reactjs - Where can I redirect to a different page in React-router 1.0 -


render(){     if (!this.readyforstep()){         this.props.history.pushstate(null, `step2`);     }     // cannot update during existing state transition (such within `render`). render methods should pure function of props , state. } 

so can't redirect in render()... in component lifecycle can/should i?

depending on specific semantics want redirecting before or after render, can make check in of componentdidmount, componentwillreceiveprops, or componentdidupdate.

synchronous transitions lead state updates in <router> component, can't make them in place couldn't call setstate.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -