score:1
Accepted answer
check out this working example (i placed notes in each file):
https://codesandbox.io/s/modest-panini-hkzlv?file=/src/app.js
overview:
- there are several ways to do this
- my suggestion is to use the history npm and create a history.js file
- you will also need to use router from react-router-dom
- in your parent component, or in a context provider, you can store your state
- in the parent component, use react-router-dom switch and route to place routes
- depending on implementation, conditionally render show route for async state update
- in your search component, place all your links using react-router-dom
- on click links should also update app's state of your specific selection
- this selection gets passed to the show route/component
- in the show component attach an on click that uses history.goback and resets state
score:-1
this might help you:
this.props.history.goback();
it goes back to prev page
Source: stackoverflow.com
Related Query
- How to create a button that opens a new page with the option to return back to previous page [ReactJS
- How to open a page in new tab on click of a button in react? I want to send some data to that page also
- How to create a package with the isolatedModules=true option enabled?
- How can I create a custom page with #react-admin without the menu sidebar like login page?
- How do you create multiple forms on the same page with redux-forms v6?
- How to create a Micro Frontend bundle with Webpack that shares libraries with the container application?
- How to create a show more/less button with ReactJS to adjust the size of a div?
- How to create a new page on Ionic with react?
- How can I create a button which Fetches image from API and download to the local with using ReactJs
- How can I count the number of components on a page that have been connected with redux' connect() function?
- How to access the url or page that is currently loading on navigation with Next.js
- How to Create a dropdown Button with see more option and on click toggle should not happen in react js?
- How to open a new page with specific dataset with a button click in react?
- how can I use sass with the new create react app?
- How to make an href dropdown item that does not reload the page with React-boostrap
- Why browser back button returns a blank page with the previous URL
- How to get a login button to navigate to a new page once clicked. I have downloaded and used the React router dom
- How to hide a parent div and replace it with another div when user clicks on a button that is a children of the parent div?
- how can i create Shopify APP that interact with user from product detail page
- My React 18 app does not reload automatically I try to click on the create new project button does not work unless I refresh the page manually
- How can i connect redux with localStorage so that when updating the like on the page does not disappear
- How to create a new page and route programatically in React.js with React Router
- How to create a vertical divider with a <hr> tag that can dynamically adjust its height relative to the element to the left?
- How do the map function that return an object with modified keys? (JS, React.js)
- I want to call the same popup with input fields when I click on edit button which is inside that popup, how can I do this (if possible)?
- React Router: How to re-render the page when the user presses the back button
- How can i create a new div when i onclick the button in React js?
- How to create an input formfield with button that uploads a file using react and javascript?
- How can I return back to the page after I click yes in a modal?
- How to assign arrays student's id with Boolean value in react js and if i clicked on button again back to boolean value for that particular student
More Query from same tag
- Jest on Reactjs for simulate a click with a reference function
- how to test props which is pass through Link in react router with React-testing-library or jest
- [TypeGraphQL]Cannot determine GraphQL input type
- how to return the tag where the click event happened
- Getting 415 error when trying to pass in multiple arguments to a get request in React with axios
- ChartJs/React how to update state of nested object within a nested object
- Javascript: How to count how much time a user spent watching a video?
- Should i fetch data in react component or redux action?
- state containing an array is not updating
- How to use react-redux in Visual Studio
- remove multiple object from array and return updated array
- ReactJS display data from Wordpress API
- Sanity newly added field is not showing on queries
- UseState loads previous state when value changes (NextJS)
- Redux store does not create
- How to stop inner onClick event's propogating into outer onSubmit event in React?
- image tag - how to put on an ICON (not string - NOT URL) in case of url failure?
- React : state object property is not updating
- How to pass JS variables to JSX files
- How to make React app background color have infinite height
- React Router v4 fetch data based on params
- `window` is not being exposed to Jest
- How to do the single element view should look like multi in react-select?
- The pattern in the "src" property didn't match any files" React.js
- How to establish a dynamic grid with 2 rows and 2 columns depending on the amount of elements?
- How to keep the state variable value intact upon screen reload
- Getting ''Invariant Violation: Native module cannot be null.'' when I run the test
- React Hooks(useEffect) form Sub mission
- Using document.cookie in Gatsby
- Having issues typing into my input box or clicking on things[React]