I have a route like
<Route path="/search/:slug"><SearchPage /></Route>
in my React Router. SearchPage is a component that uses the useParams() hook provided by react-router-dom.
// SearchPage.js
import React from 'react';
import { useParams } from 'react-router-dom';
export function SearchPage(props) {
const { slug } = useParams();
console.log(slug)
// ...do other stuff
}
However, when I navigate to /search/foo#bar, the SearchPage component only receives foo in the slug. It is possible for my component to receive the full foo#bar, or, better yet, foo and bar separately?