Skip to content

[Proposal] context #1544

Closed Answered by dai-shi
probeiuscorp asked this question in Ideas
Nov 7, 2022 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

Yes, we misguided the use of Provider for initializing atom values from props. That doesn't work well for typical cases.
useHydrateAtoms were to rescue, but it can only set values for uninitialized atoms, which doesn't cover all cases.

I think what you propose is covered by jotai-molecules. If so, what we should do is to write docs about it and recommend using it.

From the API surface, your proposal looks a little different though. I like the idea of making an atom contextual. Although, we can't implement the proposed api without breaking some of React rules. (Otherwise, we could have made useHydrateAtoms to update already initialized atoms.)

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@probeiuscorp
Comment options

Answer selected by probeiuscorp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
2 participants