the order of withRouter and connect is reset (#10658)
per [this link](https://github.com/ReactTraining/react-router/blob/master/packages/react-router/docs/api/withRouter.md) becasue ` If you are using withRouter to prevent updates from being blocked by shouldComponentUpdate, it is important that withRouter wraps the component that implements shouldComponentUpdate. `
zhangs committed
Sep 10, 2017 at 14:56 UTC
044015760883d03f060301a15beef17909abbf71
1 file changed
+3
-3
docs/docs/higher-order-components.md
+3
-3
@@ -279,14 +279,14 @@ This form may seem confusing or unnecessary, but it has a useful property. Singl
279
280
```js
281
// Instead of doing this...
282
-const EnhancedComponent = connect(commentSelector)(withRouter(WrappedComponent))
282
+const EnhancedComponent = withRouter(connect(commentSelector)(WrappedComponent))
283
284
// ... you can use a function composition utility
285
// compose(f, g, h) is the same as (...args) => f(g(h(...args)))
286
const enhance = compose(
287
// These are both single-argument HOCs
288
- connect(commentSelector),
289
- withRouter
288
+ withRouter,
289
+ connect(commentSelector)
290
)
291
const EnhancedComponent = enhance(WrappedComponent)
292
```