Recoil is an experimental state management library for React apps. It provides several capabilities that are difficult to achieve with React alone, while being compatible with the newest features of React.
Our app uses Recoil, but also consumes a library component that also use Recoil. They both use initializeState. The expectation is that we can initialise atoms related to the outer store in the outer RecoilRoot, and atoms related to the inner store in the inner RecoilRoot. I have contrived a reduced example of what we're trying to achieve:
Our app uses Recoil, but also consumes a library component that also use Recoil. They both use
initializeState
. The expectation is that we can initialise atoms related to the outer store in the outerRecoilRoot
, and atoms related to the inner store in the innerRecoilRoot
. I have contrived a reduced example of what we're trying to achieve:The expected output of the above is:
The actual result is: