0

I currently have a Switch/Route system like this:

        <Switch>
          <Route path="/app" exact>
            <AppPage/>
          </Route>
        </Switch>

I now want an optional query param such that the path would be

/app?code=:code

So /app or /app?code=:code should both redirect to <AppPage> However when I change the code to

        <Switch>
          <Route path="/app?code=:code" exact>
            <AppPage/>
          </Route>
        </Switch>

going to app or app?code=123 now redirects to nothing. Am I missing something?

Drew Reese
  • 165,259
  • 14
  • 153
  • 181
  • No sorry to be clear I want either /app or /app?code=123 to redirect to AppPage, with /app?code=123 having the query param 123 – Timothy Ong Oct 19 '22 at 06:48

0 Answers0