4.0.0
1) create a Link component like that
<Link to={{ pathname: '/homepage', query: {...oldQuery, image: 11} }}>
Image capture
</Link>
2) Click the first time on this Link
3) Then check the HREF atribute of DOM element
After the first click DOM element should be <a href='/homepage?album=1&image=11'>
But actually it is <a href='/homepage?album=1&image=11'>
The query property of location objects is no longer supported. It would take me a while to explain all the details, but basically it boils down to there being query objects are not standardized and React Router/history not actually have an internal use for query objects. Instead, you should pick your own query package to parse and stringify location.search.
I wrote qhistory for people who really want query support. It works basically the same way that useQueries did with history v2/3.
Thank u for this clarifications!
so, i'll consider your library
Most helpful comment
The
queryproperty of location objects is no longer supported. It would take me a while to explain all the details, but basically it boils down to there being query objects are not standardized and React Router/history not actually have an internal use forqueryobjects. Instead, you should pick your own query package to parse and stringifylocation.search.I wrote
qhistoryfor people who really wantquerysupport. It works basically the same way thatuseQueriesdid withhistoryv2/3.