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

**URL:** <https://community.auth0.com/t/code-problem-spoted-on-the-new-react-authentication-by-example-using-react-router-6/98252>\
**Category:** Get Help\
**Tags:** auth0\
**Created:** [January 16, 2023, 2:40pm UTC](https://community.auth0.com/t/code-problem-spoted-on-the-new-react-authentication-by-example-using-react-router-6/98252 "2023-01-16T14:40:40Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![oscar.gch](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/oscar.gch/32/34847_2.png) [@oscar.gch](https://community.auth0.com/u/oscar.gch)\
**Post date:** [January 16, 2023, 2:40pm UTC](https://community.auth0.com/t/code-problem-spoted-on-the-new-react-authentication-by-example-using-react-router-6/98252/1 "2023-01-16T14:40:40Z")

</div>

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 { }

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [January 17, 2023, 2:01pm UTC](https://community.auth0.com/t/code-problem-spoted-on-the-new-react-authentication-by-example-using-react-router-6/98252/2 "2023-01-17T14:01:54Z")

</div>

Perfect highlighting the trick here then:

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

```

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

---

<div class="post-metadata">

**Author:** ![oscar.gch](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/oscar.gch/32/34847_2.png) [@oscar.gch](https://community.auth0.com/u/oscar.gch)\
**Post date:** [January 17, 2023, 2:08pm UTC](https://community.auth0.com/t/code-problem-spoted-on-the-new-react-authentication-by-example-using-react-router-6/98252/3 "2023-01-17T14:08:15Z")

</div>

> **[React Authentication By Example: Using React Router 6](https://developer.auth0.com/resources/guides/spa/react/basic-authentication)**
>
> Learn how to add authentication features to React v18 apps: add login, logout, and sign-up. Learn how to integrate Auth0 with React Router v6 to protect React pages using router guards and how to call protected APIs.

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [January 18, 2023, 11:38am UTC](https://community.auth0.com/t/code-problem-spoted-on-the-new-react-authentication-by-example-using-react-router-6/98252/4 "2023-01-18T11:38:03Z")

</div>

Perfect! I’ll ping the team to change it

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [February 1, 2023, 11:38am UTC](https://community.auth0.com/t/code-problem-spoted-on-the-new-react-authentication-by-example-using-react-router-6/98252/5 "2023-02-01T11:38:26Z")

</div>

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