I am using react router dom v6 how can I access the context in a nested route in the second child
<Routes>
<Route element={<Parent/>}>
<Route element={<Child/>}>
<Route element={<ChildSecond/>}/>
</Route>
<Route>
</Routes>
I passed a context to Outlet in Parent Component I wanna access it in ChildSecond with out passing it again in Child component Outlet
expected code
Parent Component:
const Parent = ()=>{
const myContext = {someData:'hello world'}
return <Outlet context={myContext}/>
}
Child Component:
const Child = ()=><Outlet/>
ChildSecond component
import {useOutletContext} from 'react-router-dom'
const ChildSecond = ()=>{
const {someData} = useOutletContext()
return <div>someData</div>
}