With react-router
I can use the Link
element to create links which are natively handled by react router.
I see internally it calls t
If happen to pair RR4 w/ redux through react-router-redux, use the routing action creators from react-router-redux
is a option as well.
import { push, replace, ... } from 'react-router-redux'
class WrappedComponent extends React.Component {
handleRedirect(url, replaceState = true) {
replaceState
? this.props.dispatch(replace(url))
: this.props.dispatch(push(url))
}
render() { ... }
}
export default connect(null)(WrappedComponent)
If use redux thunk/saga to manage async flow, import the above action creators in redux actions and hook to react components using mapDispatchToProps might be better.