Skip to content

Commit

Permalink
Merge pull request #242 from asgardeo/pavinduLakshan-patch-2
Browse files Browse the repository at this point in the history
Fix react router v6 example
  • Loading branch information
pavinduLakshan authored Aug 9, 2024
2 parents 62b33c3 + de409a3 commit 2c5aad3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ It's also possible to implement your own routing logic to secure the protected r

Create a reusable component that redirects user to the sign in page based on the authentication status.

**ProtectedRoute.js**
**ProtectedRoute.jsx**

```js
import { useAuthContext } from '@asgardeo/auth-react';
Expand All @@ -203,7 +203,7 @@ const ProtectedRoute = ({ children }) => {
if (!isAuthenticated) {
return (
<button
onClick={ () => signIn }
onClick={ () => signIn() }
>
Sign In
</button>
Expand All @@ -220,7 +220,7 @@ Use the `ProtectedRoute` as follows, in your route definition.

```js
import { AuthProvider } from '@asgardeo/auth-react'
import { Routes, Route } from 'react-router-dom'
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom'
import ProtectedRoute from './components/ProtectedRoute'
import Home from './pages/Home'
import Dashboard from './pages/Dashboard'
Expand Down

0 comments on commit 2c5aad3

Please sign in to comment.