Группа волонтеров по всему миру работает над React и React Native приложениями для ADHD America. В своей работе они используют Recoil — довольно новую библиотеку для работы с состоянием в Реакт приложениях. Сергей Журавель рассказывает почему они решили попробовать Recoil и показывает как использоватьт Recoil в React и React Native приложениях.
2. Sergii Zhuravel
Key facts
• Industry:
Telecom, IoT, Automotive, CRM
• Location:
Kyiv, UKR
• Position:
Lead Software Engineer
• Company
Absio
Fan of JavaScript and JS frameworks. I like table tennis,
fishing and traveling
3. Plan to review
•Проблема управления стейтом в React
•Популярные решения для управления стейтом
•Основы Recoil
•Что такое ADHD и почему мы используем Recoil
•Как мы используем Recoil в мобильном приложении
•Тестирование Recoil атомов и селекторов
4. State management problem in React
❑Различные типы стейта
❑Много библиотек и подходов
❑Различные платформы(React, React native)
5. Types of state
1. Component’s (local) State
2. Components shared state
3. App’s (global) state
4. UI state
5. Cache (Redux, GraphQL cache)
9. Recoil – Advantages
1.Minimal and Reactish
2.Easy Learning Curve (just Atoms and Selectors)
3.Boilerplate-free API
4.Distributed and incremental state definition
5.Supports React Suspense
12. Recoil – Selectors
A selector represents a piece of derived
state. You can think of derived state as the
output of passing state to a pure function
that modifies the given state in some way.
30. Testing Recoil – RecoilObserver
Use ReoilObserver to track atom
and/or selector change
31. Testing Recoil - snapshot_UNSTABLE()
Use ReoilObserver to track atom
and/or selector change
32. Summary:
• Recoil is still experimental, but it’s used in production in many projects
• Recoil can be used in React and React native
• Recoil is very easy to test (within React context and outside)
• Have you tried Recoil already?