'Passing props from outlet to parent using React Router 6
I'm using React Router V6 and im trying to figure out if I can pass props from nested routes which are rendered using Outlet components. I can't seem to figure it out though. Can anyone help?
E.g. trying to pass the title prop from BleTable ("Bluetooth") to App
ReactDOM.render(
<React.StrictMode>
<BrowserRouter>
<Routes>
<Route path="/" element={<App title="**Title from outlet**" />} >
<Route path="ble" element={<BleTable title="Bluetooth"/>}/>
<Route path="create-user" element={<UserForm/>}/>
</Route>
</Routes>
</BrowserRouter>
</React.StrictMode>,
document.getElementById('root')
);
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
