Potentially confusing definition of "Higher-order component" in v1 docs
See original GitHub issue- I have searched the issues of this repository and believe that this is not a duplicate.
Thank you for writing this library! It’s definitely one of my favorite sources for learning how to write React components.
Minor question - I’m reading the CSS-in-JS section of the v1 docs, and correct me if I’m wrong, I think I see 2 definitions of “higher-order component”…
Definition 1
We use the
withStyles
higher-order component to inject an array of styles…
Definition 2
API
withStyles(styles, [options]) => Higher-order Component
If I understood this correctly, the docs are saying that withStyles
is a HOC that returns a HOC?
I think the React docs on HOCs seem to prefer the 1st definition; preferring instead to call the returned object an EnhancedComponent
.
I’m not too worried about this personally, but I think this part of the docs may be confusing for those unfamiliar with the HOC term.
<aside>I don’t personally resonate with the React official definition… I think it’s confusing that React Components can be rendered but Higher-order Components can’t; but this definition seems to be standard now so I’ve gotten used to it.</aside>
Thoughts?
Issue Analytics
- State:
- Created 6 years ago
- Comments:10 (10 by maintainers)
Top GitHub Comments
@rosskevin Not if we refer to other libraries. Let’s take the recompose documentation: https://github.com/acdlite/recompose/blob/master/docs/API.md.
I think that keeping the distinction will help people better understanding the concepts.
Can I make a PR?? @oliviertassinari.