Open SeokminHong opened 1 month ago
I'm open to this option! What is your reason to wrap the createContext method?
Sorry for late response 🙏
One use case for this is Radix UI, which uses a custom createContext method to prevent useContext from being called outside its intended scope.
My team also uses similar methods, so I'd like to allow contexts created using these approaches.
Thanks for the update.
I'm still unsure on how this pattern from Radix impact source code in project that use it. Do you have an example? (I've not used Radix yet).
So you also have files that have factories that create the useContext and Provider together? I'm a bit afraid that this leads to bad HMR experience. Can you provide a small example like what a simple UserContext would look like?
This allows users to specify custom context-creating methods, in addition to the default
createContext
from React.Related: #54