|
|
|
|
|
by m0meni
3007 days ago
|
|
I'm curious that with the addition of APIs like forwardRef, if it wouldn't make sense to just add some HOC helper that does the HOC ceremony for you. For example, if you look at withRouter[0] from react-router 1. you need to set the display name 2. you need to set the wrapped component 3. you need to hoist statics 4. and with this update, you'd forward refs Granted, I could just write it myself real quick, but it'd be nice to just have an API you could use that doesn't require you to fully grasp all the complications that come with using a HOC. I've recently just deferred to using render props instead of HOCs. Render props also require way less complex type definitions if you're using flow or typescript. [0]: https://github.com/ReactTraining/react-router/blob/master/pa... |
|