"This component must be used inside a <RecoilRoot> component" when importing from "recoil."
See original GitHub issueI got the recoil root error with,
import React from 'react';
import { RecoilRoot } from 'recoil'
import Header from 'components/Header';
import Body from 'componentsBody';
const App = () => {
return (
<RecoilRoot>
<Header />
<Body />
</RecoilRoot>
}
modifying to
import { RecoilRoot } from 'recoil/dist/recoil.production'
appears to resolve it.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:7
- Comments:9 (3 by maintainers)
Top Results From Across the Web
ReactJS error is "This component must be used inside a ...
Components that use recoil state need RecoilRoot to appear somewhere in the parent tree. A good place to put this is in your...
Read more >This component must be used inside a <RecoilRoot ...
Hi, I followed the Quick start tutorial (https://docs.onflow.org/flow-js-sdk/flow-app-quickstart). I end up getting an error: This component ...
Read more ><RecoilRoot> | Recoil
<RecoilRoot>. Provides the context in which atoms have values. Must be an ancestor of any component that uses any Recoil hooks.
Read more >How to Use Recoil for State Management in Your React Projects
You can simply do this by importing and adding RecoilRoot in your index.js ... Now let's create a component to display a todo...
Read more >Unable to use "useSetRecoilState" in story #17082 - Issuehunt
export const DateInputField = ({recoilStateName}) => { const isDisabled ... from Storybook is "This component must be used inside a <RecoilRoot> component.
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 FreeTop 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
Top GitHub Comments
I solved by import inside the index.js and wrapping the App (comontent) with RecoilRoot instead of import it into the App.js
Issue also isn’t experienced with 0.0.7