jotaijs / jotai-scope

MIT License
60 stars 4 forks source link

expose context from create isolation #26

Closed marcocondrache closed 6 months ago

marcocondrache commented 7 months ago

Because useStore by default uses the default context, when working in isolation, it's not possible to utilize hooks like useHydrateAtoms, as they all rely on useStore. Consequently, they would hydrate a different store from a different context.

I think it would be correct and beneficial either to directly export the context or to offer a custom useStore function, allowing other hooks to receive the store as an option.

I'm willing to submit a pull request if necessary.

dai-shi commented 7 months ago

Nice catch.

to offer a custom useStore function

Let's do that. Yes, please open a PR.

marcocondrache commented 7 months ago

@dai-shi thank you. I've opened the PR.