Add support for composed component via HoC
See original GitHub issueHoC is a good pattern but when I use it, component are not recognized as such.
import Wrapper from "./Wrapper"
const SidebarItem = (props) => {
return (
// ...
)
})
export default Wrapper(SidebarItem)
Any idea how can we add support for this?
I tried to add export { SidebarItem }
but no luck 😕
Issue Analytics
- State:
- Created 7 years ago
- Reactions:16
- Comments:16 (5 by maintainers)
Top Results From Across the Web
React — Composing Higher-Order Components (HOCs)
To put it simply, a higher-order component is a function, ... We can create an HOC that handles and shares functionality to easily...
Read more >Higher-Order Components - React
A higher-order component (HOC) is an advanced technique in React for reusing component logic. ... On mount, add a change listener to DataSource...
Read more >What are the different ways in which React HOC components ...
React HOCA HOC can be imagined as a component which is passed to some function. ... The above way of using HOC allows...
Read more >Using Recompose to write clean higher-order components
Learn how Recompose methods can help create cleaner HOCs and how it simplifies the development and organization of React components.
Read more >Write better React, compose multiple functional HoCs, Higher ...
Write better React, compose multiple functional HoCs, Higher-Order Components. In a previous article, I wrote about the concept of chaining functions using ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I noticed that react-docgen has a pull request recently to add an HOC resolver in the mix. https://github.com/reactjs/react-docgen/pull/124
My temporary solution is having a directory structure like this:
Where index.js serves as the entry point and the HoC wrapping happens there, thus leaving my-component.jsx unwrapped, and using that in the styleguide instead and manually passing it whatever props the HoC provided.