Skip to content
This repository has been archived by the owner on Jan 1, 2025. It is now read-only.

State sharing in different RecoilRoot components #414

Closed
daliusd opened this issue Jun 29, 2020 · 7 comments
Closed

State sharing in different RecoilRoot components #414

daliusd opened this issue Jun 29, 2020 · 7 comments
Labels
duplicate This issue or pull request already exists enhancement New feature or request

Comments

@daliusd
Copy link

daliusd commented Jun 29, 2020

We have situation where we need to share state between different RecoilRoot components. I have not found a way to do that via API so I assume it is not possible to do that. Maybe it would be possible to add argument allowing passing state's instance to RecoilRoot component?

@mondaychen
Copy link
Contributor

Can you provide more details on why you need to share state between different RecoilRoot components, rather than using one RecoilRoot to wrap them all?

@daliusd
Copy link
Author

daliusd commented Jun 29, 2020

We need to share state between different applications (old project gradually moving to React). There is no way to wrap everything under single RecoilRoot.

E.g. with Redux we can pass store instance to redux Provider components so it would be good if that were possible with Recoil as well.

@mondaychen mondaychen added the enhancement New feature or request label Jun 29, 2020
@mondaychen
Copy link
Contributor

@drarmstr is this possible yet?

@adrianbw
Copy link

Is this possible using an observer and passing the state setting function in from within the other recoil root?

@drarmstr
Copy link
Contributor

Related to #140?

@daliusd
Copy link
Author

daliusd commented Jun 29, 2020

Related to #140?

It is probable that solution to #140 might solve this problem as well. IMHO you can mark this as duplicate of #140 now. In case solution to #140 will not be enough then I or someone else can reopen this issue.

@drarmstr drarmstr added the duplicate This issue or pull request already exists label Jun 29, 2020
@drarmstr
Copy link
Contributor

Duplicate of #140

@drarmstr drarmstr marked this as a duplicate of #140 Jun 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
duplicate This issue or pull request already exists enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants