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
If you enable the "react-refresh/only-export-components" lint check in eslint on a React project, then it will complain about non-component exports from shadcn components.
This eslint check is only needed if you're using "react-refresh" for HMR in your project (a default Vite setup is an example). I don't think this is an issue with NextJs, because it uses WebPack HMR.
I'm curious if this warning should be taken seriously or not. First of all, it's designed to optimize the HMR of component changes and 90% of the time you're not going to be editing shadcn components while working on a project.
As for a discussion, I'm curious if this practice of exporting multiple var types from a component is a good practice or not. The recommend "react-refresh" approach would be to separate "Button" and "buttonVariants" into different files. Which I think makes it harder to maintain, but I'm curious if anyone considers the HMR warnings serious or not.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
If you enable the "react-refresh/only-export-components" lint check in eslint on a React project, then it will complain about non-component exports from shadcn components.
This eslint check is only needed if you're using "react-refresh" for HMR in your project (a default Vite setup is an example). I don't think this is an issue with NextJs, because it uses WebPack HMR.
I'm curious if this warning should be taken seriously or not. First of all, it's designed to optimize the HMR of component changes and 90% of the time you're not going to be editing shadcn components while working on a project.
As for a discussion, I'm curious if this practice of exporting multiple var types from a component is a good practice or not. The recommend "react-refresh" approach would be to separate "Button" and "buttonVariants" into different files. Which I think makes it harder to maintain, but I'm curious if anyone considers the HMR warnings serious or not.
Beta Was this translation helpful? Give feedback.
All reactions