React route doesn't render component based on Django REST url

Viewed 48

I have a password reset mechanism implemented in my React app via Django Rest API endpoint. Now the Api sends an e-mail with a link in that structure:

http://localhost:3000/api/user/auth/password-reset/confirm/MQ/b3x446-bd2f340d3a6de198925002c92e361d8d

In my component I have the following route

<Routes>
    <Route exact path="/login" element={<Login />} /> // works
    <Route exact path="/reset-password" element={<ResetPassword />} /> // works
    <Route path="/api/user/auth/password-reset/confirm/*" 
    element={<ResetPasswordConfirm />} /> // doesn't work
</Routes>

Somehow the password-reset/.. route doesn't work, the others do though.

1 Answers

you can add as :id for dynamic path

<Route path="/api/user/auth/password-reset/confirm/:mq/:id" 
    element={<ResetPasswordConfirm />} />
Related