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
{{ message }}
This repository has been archived by the owner on Feb 14, 2023. It is now read-only.
In the above Cards component, this.global.cards will have two separate values, as the values will be tied to the parent Provider.
This may suit your use case. However, there are no plans to have a single instance of <Cards /> have access to both Provider1 and Provider2's respective global states. You may prefer this.global.one.cards and this.global.two.cards instead.
The hooks implementation may support something like const [ value, setValue ] = Provider1.useGlobal('cards') to let you determine which provider to use, but that's a huge may and low priority. Let me know if it is something you would be interested in.
Provider1.useGlobal('cards') seems like a hook friendly version of React context. It seems much more natural to me.
quisido
changed the title
Manage multiple global state instances with a single component.
Global Providers should have hooks as static methods (Provider.useGlobal)
Feb 15, 2019
Current is
setGlobal({ cards: [], disabled: false, initial: 'values', x: 1 });
Is it possible to group these global state like the following for better control and code management?
setGlobal-A({ cards: [], disabled: false, initial: 'values', x: 1 });
and
setGlobal-B({ posts: [], blogger: 5 });
The text was updated successfully, but these errors were encountered: