Code problem spoted on the new React Authentication By Example: Using React Router 6

On the “Add Route Guards to React” part,

the code to copy/paste reads like this(and it does not work):

<Route
    path="/profile"
    element={<AuthenticationGuard component={<ProfilePage />} />}
  />

Switched it to(it now works):

  <Route
    path="/profile"
    element={<AuthenticationGuard component={ProfilePage} />}
  />

–The problem is the < /> inside the { }

Perfect highlighting the trick here then:

<Route
    path="/profile"
    element={<AuthenticationGuard component={ProfilePage} />}
  />

Can you share a link to the doc where the issues is?

1 Like

Perfect! I’ll ping the team to change it

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.