Closed silverwind closed 1 year ago
It misses some official documentations for this. But for now the React core team don't plan to make this possible.
With the new beta just released, this now possible, it will just warn you when you do it and propagate the update.
What "breaks" is that fast-refresh is only able to create proxies for component, other exports would be stable without the new invalidation in beta.
The way I structure my codebase is that I have helpers|utils|display.ts
files (some at the root, some in views folders) to share this kind of helpers
What "breaks" is that fast-refresh is only able to create proxies for component, other exports would be stable without the new invalidation in beta.
Okay, if changes to a function export requires a full page reload, that'd be acceptable to me. Suggesting to update the docs with this info.
The new behaviour (beta version) is that it propagates the invalidation, and full-reload only if an entry point is encounter.
Readme says "For React refresh to work, your file should only export React components". I fell like this is a huge drawback to this module as I often employ a pattern to export both functions and components in the same file:
Can it be elaborated what exactly breaks when this pattern is employed? Can it be fixed?