# This component must be used inside a \<RecoilRoot\> component

**URL:** <https://forum.flow.com/t/this-component-must-be-used-inside-a-recoilroot-component/911>\
**Category:** Flow JavaScript SDK\
**Tags:** flow-sdk-js\
**Created:** [February 8, 2021, 7:58pm UTC](https://forum.flow.com/t/this-component-must-be-used-inside-a-recoilroot-component/911 "2021-02-08T19:58:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![OxComb](https://avatars.discourse-cdn.com/v4/letter/o/eb9ed0/32.png) [@OxComb](https://forum.flow.com/u/OxComb)\
**Post date:** [February 8, 2021, 7:58pm UTC](https://forum.flow.com/t/this-component-must-be-used-inside-a-recoilroot-component/911/1 "2021-02-08T19:58:22Z")

</div>

Hi,

I followed the Quick start tutorial ([https://docs.onflow.org/flow-js-sdk/flow-app-quickstart](https://docs.onflow.org/flow-js-sdk/flow-app-quickstart)). I end up getting an error: This component must be used inside a component. (see image below).

 ![image](https://us1.discourse-cdn.com/flex022/uploads/flow/original/1X/d4923b165951afb5d09d481c5621fb13fd2797f1.jpeg)

It seems that the problem is somewhere in the current-user.js file at this code block:  
export function useCurrentUser() {  
const currentUser = useRecoilValue($currentUser)

return {  
…currentUser,  
logOut: fcl.unauthenticate,  
logIn: fcl.logIn,  
signUp: fcl.signUp,  
}  
}

Is anyone able to help?

---

<div class="post-metadata">

**Author:** ![fabius](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.flow.com/fabius/32/265_2.png) [@fabius](https://forum.flow.com/u/fabius)\
**Post date:** [February 10, 2021, 10:45am UTC](https://forum.flow.com/t/this-component-must-be-used-inside-a-recoilroot-component/911/2 "2021-02-10T10:45:20Z")

</div>

Hey! Hi!

Did you check that in src/index.js the App component is wrapped by `<RecoilRoot> ?`

The whole file should look like this:

```
`// File: ./src/index.js

import "./config"
import React from "react"
import ReactDOM from "react-dom"
import App from "./App"
import reportWebVitals from "./reportWebVitals"
import {RecoilRoot} from "recoil"

ReactDOM.render(
  <React.StrictMode>
    <RecoilRoot>
     <App />
   </RecoilRoot>
</React.StrictMode>,
document.getElementById("root")
)

reportWebVitals()`
```
