twreporter-react
Version:
React-Redux site for The Reporter Foundation in Taiwan
21 lines (16 loc) • 386 B
Markdown
# Troubleshooting
### How to get previous path?
```js
<Route component={App}>
{/* ... other routes */}
</Route>
const App = React.createClass({
getInitialState() {
return { showBackButton: false }
},
componentWillReceiveProps(nextProps) {
const routeChanged = nextProps.location !== this.props.location
this.setState({ showBackButton: routeChanged })
}
})
```