- 排错
- 如何获得上一次路径?
- 如何获得上一次路径?
排错
如何获得上一次路径?
<Route component={App}>
{/* ... 其它 route */}
</Route>
const App = React.createClass({
getInitialState() {
return { showBackButton: false }
},
componentWillReceiveProps(nextProps) {
const routeChanged = nextProps.location !== this.props.location
this.setState({ showBackButton: routeChanged })
}
})