The Recoil package lives in npm. To install the latest stable version, run the following command:
Or if you're using yarn:
Recoil builds are not transpiled to ES5, and we do not support the use of Recoil with ES5. If you need to support browsers that do not provide ES6 features natively, you can do so by compiling your code with Babel and using preset @babel/preset-env. However, we do not support this and you may run into problems.
In particular, just like React, Recoil depends on the
Set types and other features of ES6. Emulation of these features using polyfills may result in far worse performance.
Since version 0.0.11, Recoil offers a UMD build that can be directly used in a
<script> tag and exposes the symbol
Recoil to the global namespace. We recommend linking to a specific version number and build to avoid unexpected breakage from newer versions:
You can browse all Recoil files on the CDN at jsdelivr.
If you are using eslint-plugin-react-hooks in your project. For example, with an eslint config like this:
It is recommended to add
'useRecoilCallback' to the list of
additionalHooks. With this change, ESLint will warn when the dependencies passed to
useRecoilCallback() are specified incorrectly and suggests a fix. The format of
additionalHooks is a regex string.