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
As a convention, React contexts usually start with a capital letter, e.g. MyContext. This means the plugin considers them a component and not report them, which is not ideal, as they still break HMR.
exportconstMyContext=createContext("hello");// not reportedexportconstComponent=()=><div>Component</div>;
It would be really good if the plugin could report these cases (probably with a new config option). I can think of two potential ways to detect React contexts:
Naming convention only - if the name starts with an capital letter and ends with Context
A constant starting with a capital letter that calls createContext
Either one or a combination of both could be used.
Let me know what you think - if you agree this would be a good addition, I could also create a PR.
Thanks!
The text was updated successfully, but these errors were encountered:
That's a good point!
I think Context is a bit too generic, so the naming convention will also trigger for people creating component like a context for a chat component that will be called ChatContext but actually be a UI sidebar or a header.
Handling the simple case for now export const MyContext = createContext("hello"); is not too hard to add so you can try to do a PR for it!
As a convention, React contexts usually start with a capital letter, e.g.
MyContext
. This means the plugin considers them a component and not report them, which is not ideal, as they still break HMR.Example:
It would be really good if the plugin could report these cases (probably with a new config option). I can think of two potential ways to detect React contexts:
Context
createContext
Either one or a combination of both could be used.
Let me know what you think - if you agree this would be a good addition, I could also create a PR.
Thanks!
The text was updated successfully, but these errors were encountered: