I know this question a bit subjective, but still. Everytime a user types in new chars into input and runs a search I need to synchronize the new search state to the URL. So I can use either history.replaceState
or history.search
for that:
input.addEventListener('change', (event)=>{
const searchString = event.current.value;
history.replaceState(..., searchString);
});
or
input.addEventListener('change', (event)=>{
const searchString = event.current.value;
history.search = searchString;
});
history.search
reloads the page though. Any other approach I'm missing? Maybe history.pushState
is more applicable?