// React Router v6:
// thin wrapper around 'new URLSearchParams(init)' which adds
// support for using objects with array values.
// Same internal fn 'useSearchParams' uses to create 'URLSearchParams'
import { createSearchParams, useNavigate } from 'react-router-dom'
const navigate = useNavigate();
navigate({
pathname: 'listing',
search: `?${createSearchParams({ foo: 'bar'}).toString()}`
})