score:2

Accepted answer

you could use react-router-dom history hooks:

first import usehistory from react-router-dom

const history = usehistory();

then you can replacce with a function onclick in your button:

history.push('yourpath', {details:detail})

either history.replace should work:

history.replace('yourpath', {details:detail})

in the following page in your case will be details page you can access your details with the hook uselocation from react-router-dom:

first import uselocation from react-router-dom

location = uselocation();

to access it:

location.state.details

i hope this work for you


Related Query

More Query from same tag