Envoyer des données via des itinéraires dans React
const navigate = useNavigate();
navigate('/other-page', { state: { id: 7, color: 'green' } });
Technical Heaven
const navigate = useNavigate();
navigate('/other-page', { state: { id: 7, color: 'green' } });
props.history.push('/other-page', { id: 7, color: 'green' }))
Then, you can access the state data in '/other-page' via:
props.location.state
const {state} = useLocation();
const { id, color } = state; // Read values passed on state