Answers for "send data through routes in react"

1

send data through routes in react

const navigate = useNavigate();
navigate('/other-page', { state: { id: 7, color: 'green' } });
Posted by: Guest on April-11-2022
0

react router how to send data

props.history.push('/other-page', { id: 7, color: 'green' }))

Then, you can access the state data in '/other-page' via:

props.location.state
Posted by: Guest on September-01-2020
0

send data through routes in react

const {state} = useLocation();
const { id, color } = state; // Read values passed on state
Posted by: Guest on April-11-2022

Code answers related to "Javascript"

Browse Popular Code Answers by Language