Support for higher-order-components such as recompose
See original GitHub issueA pattern that I tend to use is the following:
import React from 'react';
import { withState } from 'recompose'; // or any of the HOCs from recompose
const enhancer = withState('value', 'setValue', 0);
const MyComponent = ({ value, setValue }) => (
<div>
<span>Value: {String(value)}</span>
<button onClick={() => setValue(value + 1)}>Increment</button>
</div>
);
export default enhancer(MyComponent);
Because MyComponent
is not being export
ed as a const
or default
, it is not being picked up by babel-plugin-functional-hmr
.
Is there a way I can adjust my pattern or is there something that could be done regarding babel-plugin-functional-hmr
to get this experience working with HMR?
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Using Recompose to build higher-order components
Recompose is a toolkit for writing React components using higher-order components. Recompose allows us to write many smaller higher-order ...
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 >acdlite/recompose: A React utility belt for function ...
Recompose is a React utility belt for function components and higher-order components. Think of it like lodash for React.
Read more >Typing Higher-order Components in Recompose With Flow
One month ago Recompose landed an official Flow library definition. The definitions were a long time coming, considering the original PR was ...
Read more >Getting started with Higher Order Components and ...
Higher order components (HOCs) are functions that take a component and return another. The returned component is altered, typically, ...
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 FreeTop 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
Top GitHub Comments
@Gyran Thank you, this is working like a dream.
We have a branch that supports that pattern (https://github.com/bvic23/babel-plugin-functional-hmr/compare/master...Yepstr:hoc). I’m not sure that it works 100% but it works good enough for us. If anyone want to continue to work on it I’d be glad to help.