How to pass params to history.push method in React Router?

To pass parameters to the history.push method in React Router, you can use an object to specify the route to push to and include any parameters as properties of that object. For example:

pathname: '/template',
search: '?name=sudheer',
state: { detail: },

In the example above, the history.push method is being used to push a new route onto the history stack, with the route specified as the pathname property of the object passed to history.push. The search property of the object is used to specify query parameters for the route, and the state property is used to specify state that should be associated with the route.

September 27, 2022