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
Source: stackoverflow.com
Related Query
- Getting redirected to the details Page on Click
- React js-How to prevent page reload once click on the link. Right now the whole page is getting refresh on clicking the link
- React - Triggering click event on table row and display the selected row details in another page
- I am getting redirected to main page after page refresh even if the user is authenticated in private route react?
- Why does the user getting redirected to the login page on refresh?
- react router getting the right display page when click button
- Scroll page to the nested React component on a button click
- <Link> only changes the url when click but not the components and the page
- React.js page not found on refresh or on click on the link directly
- Scroll down the page to another React component on a button click
- Keep getting TypeError: Cannot read property 'map' of undefined when I click on checkbox, dont know where the problem is
- Reactjs - Toggle dropdown menu on click outside anywhere on page instead of just click on the icon
- Prevent React-router-dom to refresh the page and reset the information entered on click
- Getting error when reloading the Commerce.js Checkout page (react tutorial)
- When I first click the delete button, all the notes are disappeared but, when I refresh the page it works just fine
- How to scroll to the particular div on button click in a single page application using react-router?
- why the page refresh on button click in react?
- change profile picture when click in link to the same page
- What's the React best practice for getting data that will be used for page render?
- When I click cancel button in react why the page is reloading and why its path also changing in react?
- How to click an image and reload the current page in Reactjs?
- How can I click space to pause the video without down the page in JavaScript
- The action menu is not getting closed even if I click somewhere on page, the menu remains open until I explicitly click on the Action button again
- I'm working with React Route, and I have a random string, but when I do click on the link page works but when a do click again doesn't work
- Nextjs only go to page on button click not by typing it directly into the browser
- React Login page getting focused on 'password' when loading the page instead of 'username'
- Page becomes unresponsive and getting 404 error in the console
- What to change in the Logout.js file so that a redirect to the registration page after I click the logout button?
- If user visit any page of website first time and click backbutton, then how to land the user on home page
- In the following code How do I change code so it shows the lent details of the corresponding name when I click the notes.name button?
More Query from same tag
- How does fetchMore return data to the component?
- Send verification email before logging in
- How to call a function of a react component in other js files inside the project
- Change form.item label font size in AntD
- How to centralize forms validations in React?
- UNSAFE_componentWillReceiveProps always triggering every input value change
- How to transport a function and an object to a functional component in react
- difference between state separately and together in react js
- What is the #USAGE for Element of arrow function?
- tsc: not found at heroku when I upload the React+next js and node project
- Converting array of strings to both JSX Elements and strings in React
- React component not re-rendering after using UseState Hook
- How to host NextJS app with an Express server backend on same localhost port
- React JSX: How to avoid multiple onClick handlers for multiple elements
- Uncaught Error: Could not find "store" in the context of "Connect(RenderPolygons)" in React Redux?
- Using Redux store data to populate dropdown fields in React
- must be wrapped in an enclosing tag
- Method replacements for material ui v4 to v5 upgrade
- React GraphQL Relay - How to do a simple query?
- reactjs:unable to send the data in json format
- React App failed to compile - Module not found: Can't resolve 'react'
- React- .map is not a function
- Get access to the chart.js component instance in React
- FSlightbox when opening first time throws: Cannot read property 'zero' of undefined
- Implement react-router PrivateRoute in Typescript project
- React useEffect loop
- How to show changed edited lines (diff) in monaco editor without using the split mode diff editor?
- typescript .d.ts module for images not working
- Async React.Component doens't work for me
- useState hook: update a state based on another just updated state