I am trying to update only one query param key-value on button click using react-router (v5).
const btnClickHandler = () =>{
history.push({ search: 'popup=false' });
}
I want this code to update the url from:
https://base-url.com/?popup=true&checked=true
to:
https://base-url.com/?popup=false&checked=true
but instead, it replaces the whole search to:
https://base-url.com/?popup=false
Basically, instead of replacing all the query param key value, how can I replace only one?