-
Notifications
You must be signed in to change notification settings - Fork 0
[FEATURE] Build an app to try out Auth0 #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
* Added react-router-dom v6. * Refactored router to use App and Error pages.
* Renamed Header for consistency. * Added todos to README to document helpful links.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved. Job well done.
|
||
const Root = () => { | ||
return ( | ||
<Auth0ProviderWithNavigate> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the most important consideration, right here. We have to wrap the Auth0 context provider around the main <Outlet />
where pages are rendered in the router and write the router in a very prescriptive way.
Make sure to add the TODO to the README because there will be a lot of backtracking in the future if you don't.
}; | ||
|
||
if (!(domain && clientId && redirectUri)) { | ||
console.log("Nice goin' Ace"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be removed for a production app but was helpful when debugging why I was seeing just a blank screen.
|
||
export const router = createBrowserRouter( | ||
createRoutesFromElements( | ||
<Route path="/" element={<Root />}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is critical for the Auth0 context provider to work correctly. It's wrapped around the <Outlet />
in the Root.tsx file so we can have a one-line router in the index.tsx file.
PR closes #2