Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Anonymous arrow functions cause Fast Refresh to not preserve local component state. #6

Closed
arnaudbzn opened this issue Dec 14, 2020 · 0 comments

Comments

@arnaudbzn
Copy link

When running the example with npm run dev

The following warning is displayed in the console:

Anonymous arrow functions cause Fast Refresh to not preserve local component state.
Please add a name to your function, for example:

Before
export default () => <div />;

After
const Named = () => <div />;
export default Named;

A codemod is available to fix the most common cases: https://nextjs.link/codemod-ndc

The solution is to follow the codemod in the link above.

Example in index.js

Instead of:

export default ()  => {

You can change to:

export default function Main () {

To do in index.js, optimistic-ui.js and subscription.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant