You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/sandbox/pages/index.js
3:19 error Function component is not a functiondeclaration react/function-component-definition
✖ 1 problem (1 error, 0 warnings)
1 error and 0 warnings potentially fixable with the `--fix` option.
and on try to fixe the issue with eslint --fix
your final code is this
constgenX=(symbol)=>`the symbol is ${symbol}`;functionIndexPage(){return(<div>
Hello World.{genX(')}
</div>
)
}
export default IndexPage;
the desired result should be
const genX = (symbol) => `the symbol is ${symbol}`;
function IndexPage() {
return (
<div>
Hello World.{genX('$')}
</div>
)
}
export default IndexPage;
when you try to use
eslint --fix
to solve the issue related to the rulereact/function-component-definition
in certain scenarios break the code.this is the way to reproduce.
having this file
and this eslint config
you have this output in eslint
and on try to fixe the issue with
eslint --fix
your final code is this
the desired result should be
tested in this sandbox https://codesandbox.io/s/red-smoke-bh8tjw?file=/pages/index.js
The text was updated successfully, but these errors were encountered: