I need to route to a page when a button is clicked. And I need to pass a prop
value to that rendering component as well.
Component I need to route to when I click the button = ProcessData
my current directories look like this:
Route.js
src/
Main.jsx
ProcessData.jsx
I have a Route.js
in the root directory and it has like below.
<Route path='/banuka/process' component={ProcessData} />
But My button (which I use to click to route to this ProcessData
component is inside Main.jsx
inside the src
directory as below:
But now how can I pass the prop employeeID
to the ProcessData
component because that it is being called in the Route.js
file already?
const [employeeID, setEmployeeID] = useState("");
return(
<Link to="/banuka/process">
<Button variant="success">
Process Data
</Button>
</Link>
);
I have to render the ProcessData
component inside this Link
or any other workaround in react-router-dom
when this button is clicked and pass the props
as well?
can someone help me please?