praveenweb/swr-graphql

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

Closed this issue · 0 comments

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