SolidJSS
SolidJSโ€ข2y agoโ€ข
7 replies
Waht?

Code review request: Optional context Provider pattern

I'm trying to find a context pattern that works with/without having to wrap context Provider in app tree.

The expected behavior: When there's context Provider in the app tree, consuming component receive states relative to Provider. Otherwise, the states should be scoped locally to the consuming component.

<Provider><Consumer /></Provider>
// or
<Consumer />


What would you like to suggest the following code. Any cons?
Thank you ๐Ÿฉต
ref: https://discord.com/channels/722131463138705510/1210366012881506304
image.png
image.png
Was this page helpful?