recoil-nexus
recoil-nexus copied to clipboard
Error in build for typescript
recoil - 0.7.6 recoil-nexus - 0.4.0 react-router-dom - 6.8.2
When i am adding RecoilNexus in RecoilRoot i am getting error 'This JSX tag's 'children' prop expects a single child of type 'ReactNode', but multiple children were provided.' for RecoilRoot
<RecoilRoot>
<RecoilNexus />
<Router>
<Routes>
<Route path='/login' element={<Layout pageTitle={'Login'}/>}>
<Route index element={<Login/>}/>
</Route>
<Route path='/sign-up' element={<Layout pageTitle={'Welcome'}/>}>
<Route index element={<SignUp />}/>
</Route>
<Route path='/forgot-password' element={<Layout pageTitle={'Forgot Password'}/>}>
<Route index element={<ForgotPassword />}/>
</Route>
<Route path='/' element={<Layout pageTitle={'Home'} stateType={null} path='/'/>}>
<Route index element={<Home />}/>
</Route>
<Route path='*' element={<PageNotFound />} />
</Routes>
</Router>
</RecoilRoot>
I have a typescript project, please suggest how to resolve this.
I took some time to reproduce this but I can't see the error you're facing. Can you help to reproduce the error? Feel free to mess around with the sandbox:
https://codesandbox.io/s/confident-bartik-w6y08y?file=/src/App.js
This error comes when I use typescript, the sandbox is using js files, please check with typescript instead.