Let's say that we have a React application with an entrypoint that looks like this:
import React from 'react';
import ReactDOM from 'react-dom';
import { BrowserRouter } from 'react-router-dom';
import Application from './Application';
ReactDOM.render((
<BrowserRouter>
<Application />
</BrowserRouter>
), document.getElementById('root'));
Somewhere deep in the React application, I'd like to add (or update) query parameters in response to some user action. I could use the history.push()
method which react-router provides, but using that method causes Application
to be re-rendered.
Is it possible to add or update query parameters without Application
being re-rendered? I have found that I can change query parameters without Application
being re-rendered if I use the History API directly, but this feels like a hack.