I have a component called TableComponent. I want to redirect path tables/:table to tables/:table?tab=tab1 and all different tabs use the same TableComponent.
For example:
tables/:table?tab=tab1 -> TableComponent
tables/:table?tab=tab2 -> TableComponent
tables/:table?tab=tab3 -> TableComponent
I have the code below but it doesn't work:
<Redirect
exact
from="/tables/:table"
to={{
pathname: "/tables/:table",
search: "?tab=tab1"
}}
/>
<Route
path="/tables/:table" <- how can I make this route ignore the query params?
component={TableComponent}
/>
Or should i do the redirect inside the TableComponent?