my react redux work flow like:
my action.js
export function loginsuccess(response){ return (dispatch, getstate) => { console.log(getstate()) dispatch({ response, type: login }) console.log(getstate()) router.transitionto("/profile") }; }
i have routes.js
const routes = ( <router history={browserhistory}> <route path="/" component={app}> <indexroute component={login} /> <route name="profile" path="/profile" component={profile} /> </route> </router> ) export default routes
and root.js
class root extends component { render() { const { store } = this.props return ( <provider store={store}> <reduxrouter /> </provider> ) } } root.proptypes = { store: proptypes.object.isrequired } export default root
when doing gives me error router
not defined ?
what's wrong in here? why getting error? have provided this.props
in provider
.
anyone plz guide me through this... banging head on this.
you're trying access object called router
in loginsuccess
function unless it's global variable throw typeerror.
you need pass loginsuccess
function in order work.
function loginsuccess(response, router) { router.transitionto('/'); }
Comments
Post a Comment