How can I get the url params from a route? I got this code:
function App() {
return (
<div className="App">
<BrowserRouter>
<Routes>
<Route path="/table/:name/" element={<SortingTable/>}></Route>
<Route path="" exact element={<BasicTable/>}></Route>
</Routes>
</BrowserRouter>
</div>
);
}
I want to get the name
from the url and use it in SortingTable:
const SortingTable = ({match}) => {
let [searchParams, setSearchParams] = useSearchParams();
const [data, setData] = useState([])
const [columns, setColumns] = useState([])
const table = match.params.name //=> undefined