html5 - Why my page will not change when use history.push using react-router -
i have single page application webpage... below of code...
var createbrowserhistory = require('history/lib/createbrowserhistory'); var history = createbrowserhistory(); history.push('account/person');
when click button, can see browser's url change http://ip/account/person, nothing happened, still on same page.
but if replace url directly http://ip/account/person typing, page map correct page.
below react router config
<router history={new createbrowserhistory()}> <route path='/account' component={gift}></route> <route path='/account/person' component={person}></route> </router>
why happened?
i think need import different object handle programmatic routing:
https://github.com/reactjs/react-router/blob/master/docs/guides/navigatingoutsideofcomponents.md
import { browserhistory } 'react-router' browserhistory.push('/account/person')
Comments
Post a Comment