Include existing query params as hidden inputs in a form.
A pagination bar that does not clear the search query
<Form> <ExistingSearchParams exclude={['page']} /> <button type="submit" name="page" value="1">1</button> <button type="submit" name="page" value="2">2</button> <button type="submit" name="page" value="3">3</button></Form> Copy
<Form> <ExistingSearchParams exclude={['page']} /> <button type="submit" name="page" value="1">1</button> <button type="submit" name="page" value="2">2</button> <button type="submit" name="page" value="3">3</button></Form>
A search form that clears the page param
<Form> <ExistingSearchParams exclude={['q', 'page']} /> <input type="search" name="q" /></Form> Copy
<Form> <ExistingSearchParams exclude={['q', 'page']} /> <input type="search" name="q" /></Form>
Include existing query params as hidden inputs in a form.