<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 })
}
})