Closed innerdaze closed 11 months ago
Yeah this is an assumption builtin in the React refresh runtime: a function should start with a capital letter to be considered a component: https://github.com/facebook/react/blob/main/packages/react-refresh/src/ReactFreshRuntime.js#L715
Given the following code...
So as marked by the comments above, I see the error
Fast refresh only works when a file only exports components. Move your component(s) to a separate file.
As I am only exporting one component from this file, this seem incorrect.
I would guess this is to do with the leading
_
on the default export.If I change the code so that: -
MenuItemLink
becomes_MenuItemLink
_MenuItemLink
becomesMenuItemLink
(so that the exported name starts with a capital, and the non-exported component startds with a
_
)then it works without error.