We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
Reusing App State in React Native With Recoil - Sergii Zhuravel , React Advanced 2021
Learn how to reuse app state in React Native with Recoil, a distributed and incremental state definition system. Easy to learn and use, Recoil provides a simple API for managing state in React and React Native applications.
-
We use
use recoil value
when we need to read state and don’t want to change it. - Atom should use a unique key.
- Recoil is a distributed and incremental state definition.
-
We create a basic subject with observers and use
notify
method. - Recoil can be used in React and React Native.
- Global state is data that is shared across the application.
- Recoil is relatively easy to test within React context and outside.
- Selectors represent derived state.
- We can use recoil in navigation, such as in React Native apps.
- Cache is important for storing and retrieving data.
-
When we change recoil state, we use
use recoil state
. - Recoil is easy to learn and has a minimal codebase.
- We can reuse state configuration across multiple features.
- Atoms can be distributed and observed.
-
We can use
use recoil value
to read state and subscribe to state changes. - Recoil has a simple and easy-to-use API.
- We can use recoilSelectors to extract state management into a separate library.
- Recoil is still an experimental tool.
- It can be used in place of Redux with its similar features.
- Recoil has good support for React suspense and caching.
- Selectors can be synchronous or asynchronous.