recoil-nexus icon indicating copy to clipboard operation
recoil-nexus copied to clipboard

Error in build for typescript

Open iOS321 opened this issue 1 year ago • 2 comments

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.

iOS321 avatar Mar 03 '23 16:03 iOS321

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

luisanton-io avatar Mar 07 '23 08:03 luisanton-io

This error comes when I use typescript, the sandbox is using js files, please check with typescript instead.

iOS321 avatar Mar 16 '23 15:03 iOS321