**react-router的哲學** https://github.com/rccoder/blog/issues/29
**react-router和redux問題** 有時候,當location改變,組件並無更新(子路由組件或者activity link),主要是由於:
1.組件直接經過redux的connect
2.該組件不是路由組件,也就是沒有這樣的代碼react
緣由是redux內部實現了shouldComponentUpdate,但又沒有從react-router接收到props,意味着不會改變。解決辦法:
// before
export default connect(mapStateToProps)(Something)git
// after
import { withRouter } from 'react-router-dom'
export default withRouter(connect(mapStateToProps)(Something))
```github