Jotai for libraries
See original GitHub issueAs a library author, I want to make sure the values of the atoms my library relies upon are only updated in the jotai.Provider
s I control and not the ones, the users of my library might add to the tree for their own purposes.
I believe we need some API in jotai to support it. The initial discussion happened here
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (8 by maintainers)
Top Results From Across the Web
Jotai, primitive and flexible state management for React
Jotai takes a bottom-up approach to React state management with an atomic model ... libraries such as atomWithStore which is bound with a...
Read more >A Guide to Jotai: the Minimalist React State Management Library
How to manage global state in React using the minimalist but flexible Jotai library.
Read more >Jotai — new state management library for React - Medium
Jotai. Recently I found this new state management library for react applications. Primitive and flexible state management library for React.
Read more >Jotai: The Ultimate React State Management - 100ms
Jotai is a relatively new state management library for React. It's simple, but make no mistakes, it's a robust library. Jotai is based...
Read more >Jotai React - Best Global State Library - YouTube
Learn Jotai React library which is a simple solution for sharing global state in React applications. It is a nice alternative to useState, ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hey there!
First, thank you for jotai, it’s an amazing library and learned a lot from it.
For context, I work on the WordPress block editor and we have a data layer package called
@wordpress/data
that relies mostly on Redux stores with some specifics. We faced performance issues while rendering a lot of components and we started exploring alternatives. Right now we are considering a solution based on atoms like Recoil and Jotai.I’d have loved to be able to use Jotai directly, unfortunately, the specifics of the data module don’t allow that. We need a library that is fundamentally React agnostic, and we also need something that can work in multiple registries/scopes (and that’s why I’m commenting here).
I’m not sure if it’s any helpful but I wanted to share this very experimental PR I’m currently working on https://github.com/WordPress/gutenberg/pull/26866 which creates that (a framework and scope agnostic alternative to Recoil and Jotai). My approach there was to use “registries” (though I like the proposed name here “scope”).
@vovacodes I’m expecting a lib author to create its own wrapper, something like this:
@mdingena @youknowriad Actually, it might be a good idea to keep the core code cleaner. I’m still working on refactoring core. However, the vanilla bundle might not be very useful as is, because it would be an unusual api to support React Concurrent Mode.
(tbh, I’m not so keen to provide framework-agnostic version of atom state management, just because there are already many: mobx, reatom or naive observables)