I would suggest just using React Router directly and not keeping searchState
in Redux. React Router will inject URL parameters into your components, and you can use them in mapStateToProps(state, ownProps)
to calculate the final props.
If you really want to see route changes as actions, you can use react-router-redux for two-way syncing, but it won’t give you the params in the state—just the current location. The only use case for it if you want to record and replay actions, and have the URL bar update as you replay them.
It is by no means required—in most cases, just using React Router directly is enough.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…