What is Recoil?
Answer
Recoil is Facebook's (Meta's) experimental state management library for React, introducing the atom-based model. Core primitives: atom: a unit of state: const textState = atom({ key: 'textState', default: '' });. selector: derived state from atoms or other selectors: const charCountState = selector({ key: 'charCount', get: ({get}) => get(textState).length });. Use: const [text, setText] = useRecoilState(textState);. Advantages: fine-grained subscriptions — components only re-render when their subscribed atoms change. React-compatible — uses Suspense for async selectors. Atom effects: side effects on atom changes (logging, persistence). Limitations: experimental status for years, slower adoption, Meta has not committed to long-term maintenance. Jotai (inspired by Recoil) is considered a more production-ready alternative with a similar API but smaller bundle size and no Provider requirement. Recoil is suitable for React apps with highly granular state dependencies.