Hello Everyone,
I am making a MERN crud app where I want to pass the _id of the record from my displayRecord.js component to app.js( inside the Route path = {} ) to update my data onclick on update button
Part of the code sort of goes like this
`
<td>
<li>
<Link to={`/${record._id}`}>
<button className='updateRecordBtn' onClick={()=>updateRecord(record._id)}>UPDATE</button>
</Link>
</li>
</td>
`
I need to capture that and pass it to the path as follows
<Router>
<Routes>
<Route path={`/${record._id}`} element={<UpdateRecord />} />
<Route path='/' element={<Home/>} />
</Routes>
</Router>
How to make that {record._id} available in app.js. it is currently showing not available
Suggestions and possible solutions are appreciated
Top comments (0)