react: eslint-plugin-react-hooks does not work with wrapped components
export const Counter = () => {
let count, setCount;
if (0 === 1) {
[count, setCount] = useState(0);
}
return count;
};
const wrapper = Component => Component;
export const WrappedCounter = wrapper(() => {
let count, setCount;
if (0 === 1) {
[count, setCount] = useState(0);
}
return count;
});
Linter shows an error in the first component, but ignore the second one.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 4
- Comments: 15
Another interesting case that triggers this is using the built-in
React.memofunction: