Skip to content
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

fix: Add note for using react-router function with hooks #877

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,18 @@ function App() {
}
```

:::important
If you are using `useRoutes` or `createBrowserRouter` or have routes defined in a different file, use it in the following way. Please see [this issue](https://github.com/supertokens/supertokens-auth-react/issues/581#issuecomment-1246998493) for further details.
```tsx
const routes = getSuperTokensRoutesForReactRouterDom(reactRouterDom, [/* Other pre built UI */ EmailVerificationPreBuiltUI]);
// createBrowserRouter also works in the following way
const router = useRoutes([
...routes.map(route => route.props),
// Define more routes
])
```
:::

</Answer>

<Answer title="No">
Expand Down
12 changes: 12 additions & 0 deletions v2/emailpassword/quickstart/frontend-setup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,18 @@ class App extends React.Component {
}
```

:::important
If you are using `useRoutes` or `createBrowserRouter` or have routes defined in a different file, use it in the following way. Please see [this issue](https://github.com/supertokens/supertokens-auth-react/issues/581#issuecomment-1246998493) for further details.
```tsx
const routes = getSuperTokensRoutesForReactRouterDom(reactRouterDom, [^{recipePreBuiltUINameCapitalLetters}]);
// createBrowserRouter also works in the following way
const router = useRoutes([
...routes.map(route => route.props),
// Define more routes
])
```
:::

</TabItem>

<TabItem value="v5">
Expand Down
24 changes: 24 additions & 0 deletions v2/mfa/email-sms-otp/otp-for-all-users.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,18 @@ function App() {
}
```

:::important
If you are using `useRoutes` or `createBrowserRouter` or have routes defined in a different file, use it in the following way. Please see [this issue](https://github.com/supertokens/supertokens-auth-react/issues/581#issuecomment-1246998493) for further details.
```tsx
const routes = getSuperTokensRoutesForReactRouterDom(reactRouterDom, [EmailPasswordPreBuiltUI, ThirdPartyPreBuiltUI, PasswordlessPreBuiltUI, MultiFactorAuthPreBuiltUI]);
// createBrowserRouter also works in the following way
const router = useRoutes([
...routes.map(route => route.props),
// Define more routes
])
```
:::

</Answer>

<Answer title="No">
Expand Down Expand Up @@ -1056,6 +1068,18 @@ function App() {
}
```

:::important
If you are using `useRoutes` or `createBrowserRouter` or have routes defined in a different file, use it in the following way. Please see [this issue](https://github.com/supertokens/supertokens-auth-react/issues/581#issuecomment-1246998493) for further details.
```tsx
const routes = getSuperTokensRoutesForReactRouterDom(reactRouterDom, [EmailPasswordPreBuiltUI, ThirdPartyPreBuiltUI, PasswordlessPreBuiltUI, MultiFactorAuthPreBuiltUI]);
// createBrowserRouter also works in the following way
const router = useRoutes([
...routes.map(route => route.props),
// Define more routes
])
```
:::

</Answer>

<Answer title="No">
Expand Down
12 changes: 12 additions & 0 deletions v2/mfa/legacy-method/pre-built-ui/protecting-routes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,15 @@ function App() {
);
}
```

:::important
If you are using `useRoutes` or `createBrowserRouter` or have routes defined in a different file, use it in the following way. Please see [this issue](https://github.com/supertokens/supertokens-auth-react/issues/581#issuecomment-1246998493) for further details.
```tsx
const routes = getSuperTokensRoutesForReactRouterDom(reactRouterDom, [ThirdPartyPreBuiltUI, EmailPasswordPreBuiltUI, PasswordlessPreBuiltUI, MultiFactorAuthPreBuiltUI]);
// createBrowserRouter also works in the following way
const router = useRoutes([
...routes.map(route => route.props),
// Define more routes
])
```
:::
12 changes: 12 additions & 0 deletions v2/mfa/legacy-method/pre-built-ui/showing-login-ui.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -204,3 +204,15 @@ function App() {
}
```

:::important
If you are using `useRoutes` or `createBrowserRouter` or have routes defined in a different file, use it in the following way. Please see [this issue](https://github.com/supertokens/supertokens-auth-react/issues/581#issuecomment-1246998493) for further details.
```tsx
const routes = getSuperTokensRoutesForReactRouterDom(reactRouterDom, [ThirdPartyPreBuiltUI, EmailPasswordPreBuiltUI, PasswordlessPreBuiltUI, MultiFactorAuthPreBuiltUI]);
// createBrowserRouter also works in the following way
const router = useRoutes([
...routes.map(route => route.props),
// Define more routes
])
```
:::

24 changes: 24 additions & 0 deletions v2/mfa/totp/totp-for-all-users.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,18 @@ function App() {
}
```

:::important
If you are using `useRoutes` or `createBrowserRouter` or have routes defined in a different file, use it in the following way. Please see [this issue](https://github.com/supertokens/supertokens-auth-react/issues/581#issuecomment-1246998493) for further details.
```tsx
const routes = getSuperTokensRoutesForReactRouterDom(reactRouterDOM, [/* ... */ TOTPPreBuiltUI, MultiFactorAuthPreBuiltUI]);
// createBrowserRouter also works in the following way
const router = useRoutes([
...routes.map(route => route.props),
// Define more routes
])
```
:::

</Answer>

<Answer title="No">
Expand Down Expand Up @@ -1266,6 +1278,18 @@ function App() {
}
```

:::important
If you are using `useRoutes` or `createBrowserRouter` or have routes defined in a different file, use it in the following way. Please see [this issue](https://github.com/supertokens/supertokens-auth-react/issues/581#issuecomment-1246998493) for further details.
```tsx
const routes = getSuperTokensRoutesForReactRouterDom(reactRouterDOM, [/* ... */ TOTPPreBuiltUI, MultiFactorAuthPreBuiltUI]);
// createBrowserRouter also works in the following way
const router = useRoutes([
...routes.map(route => route.props),
// Define more routes
])
```
:::

</Answer>

<Answer title="No">
Expand Down
12 changes: 12 additions & 0 deletions v2/passwordless/common-customizations/email-verification/about.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,18 @@ function App() {
}
```

:::important
If you are using `useRoutes` or `createBrowserRouter` or have routes defined in a different file, use it in the following way. Please see [this issue](https://github.com/supertokens/supertokens-auth-react/issues/581#issuecomment-1246998493) for further details.
```tsx
const routes = getSuperTokensRoutesForReactRouterDom(reactRouterDOM, [/* Other pre built UI */ EmailVerificationPreBuiltUI]);
// createBrowserRouter also works in the following way
const router = useRoutes([
...routes.map(route => route.props),
// Define more routes
])
```
:::

</Answer>

<Answer title="No">
Expand Down
12 changes: 12 additions & 0 deletions v2/passwordless/quickstart/frontend-setup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,18 @@ class App extends React.Component {
}
```

:::important
If you are using `useRoutes` or `createBrowserRouter` or have routes defined in a different file, use it in the following way. Please see [this issue](https://github.com/supertokens/supertokens-auth-react/issues/581#issuecomment-1246998493) for further details.
```tsx
const routes = getSuperTokensRoutesForReactRouterDom(reactRouterDom, [^{recipePreBuiltUINameCapitalLetters}]);
// createBrowserRouter also works in the following way
const router = useRoutes([
...routes.map(route => route.props),
// Define more routes
])
```
:::

</TabItem>

<TabItem value="v5">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ export default function AngularUIImplementation(props: PropsWithChildren<{}>) {
return (
<Question
question="What type of UI are you using?"
persistentId="angular-ui"
porcellus marked this conversation as resolved.
Show resolved Hide resolved
>
{props.children}
</Question>
Expand Down
1 change: 0 additions & 1 deletion v2/src/components/reusableSnippets/vueUIImplementation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ export default function VueUIImplementation(props: PropsWithChildren<{}>) {
return (
<Question
question="What type of UI are you using?"
persistentId="vue-ui"
>
{props.children}
</Question>
Expand Down
12 changes: 12 additions & 0 deletions v2/thirdparty/common-customizations/email-verification/about.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,18 @@ function App() {
}
```

:::important
If you are using `useRoutes` or `createBrowserRouter` or have routes defined in a different file, use it in the following way. Please see [this issue](https://github.com/supertokens/supertokens-auth-react/issues/581#issuecomment-1246998493) for further details.
```tsx
const routes = getSuperTokensRoutesForReactRouterDom(reactRouterDOM, [/* Other pre built UI */ EmailVerificationPreBuiltUI]);
// createBrowserRouter also works in the following way
const router = useRoutes([
...routes.map(route => route.props),
// Define more routes
])
```
:::

</Answer>

<Answer title="No">
Expand Down
12 changes: 12 additions & 0 deletions v2/thirdparty/quickstart/frontend-setup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,18 @@ class App extends React.Component {
}
```

:::important
If you are using `useRoutes` or `createBrowserRouter` or have routes defined in a different file, use it in the following way. Please see [this issue](https://github.com/supertokens/supertokens-auth-react/issues/581#issuecomment-1246998493) for further details.
```tsx
const routes = getSuperTokensRoutesForReactRouterDom(reactRouterDom, [^{recipePreBuiltUINameCapitalLetters}]);
// createBrowserRouter also works in the following way
const router = useRoutes([
...routes.map(route => route.props),
// Define more routes
])
```
:::

</TabItem>

<TabItem value="v5">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,18 @@ function App() {
}
```

:::important
If you are using `useRoutes` or `createBrowserRouter` or have routes defined in a different file, use it in the following way. Please see [this issue](https://github.com/supertokens/supertokens-auth-react/issues/581#issuecomment-1246998493) for further details.
```tsx
const routes = getSuperTokensRoutesForReactRouterDom(reactRouterDOM, [/* Other pre built UI */ EmailVerificationPreBuiltUI]);
// createBrowserRouter also works in the following way
const router = useRoutes([
...routes.map(route => route.props),
// Define more routes
])
```
:::

</Answer>

<Answer title="No">
Expand Down
12 changes: 12 additions & 0 deletions v2/thirdpartyemailpassword/quickstart/frontend-setup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,18 @@ class App extends React.Component {
}
```

:::important
If you are using `useRoutes` or `createBrowserRouter` or have routes defined in a different file, use it in the following way. Please see [this issue](https://github.com/supertokens/supertokens-auth-react/issues/581#issuecomment-1246998493) for further details.
```tsx
const routes = getSuperTokensRoutesForReactRouterDom(reactRouterDom, [^{recipePreBuiltUINameCapitalLetters}]);
// createBrowserRouter also works in the following way
const router = useRoutes([
...routes.map(route => route.props),
// Define more routes
])
```
:::

</TabItem>

<TabItem value="v5">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,18 @@ function App() {
}
```

:::important
If you are using `useRoutes` or `createBrowserRouter` or have routes defined in a different file, use it in the following way. Please see [this issue](https://github.com/supertokens/supertokens-auth-react/issues/581#issuecomment-1246998493) for further details.
```tsx
const routes = getSuperTokensRoutesForReactRouterDom(reactRouterDOM, [/* Other pre built UI */ EmailVerificationPreBuiltUI]);
// createBrowserRouter also works in the following way
const router = useRoutes([
...routes.map(route => route.props),
// Define more routes
])
```
:::

</Answer>

<Answer title="No">
Expand Down
12 changes: 12 additions & 0 deletions v2/thirdpartypasswordless/quickstart/frontend-setup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,18 @@ class App extends React.Component {
}
```

:::important
If you are using `useRoutes` or `createBrowserRouter` or have routes defined in a different file, use it in the following way. Please see [this issue](https://github.com/supertokens/supertokens-auth-react/issues/581#issuecomment-1246998493) for further details.
```tsx
const routes = getSuperTokensRoutesForReactRouterDom(reactRouterDom, [^{recipePreBuiltUINameCapitalLetters}]);
// createBrowserRouter also works in the following way
const router = useRoutes([
...routes.map(route => route.props),
// Define more routes
])
```
:::

</TabItem>

<TabItem value="v5">
Expand Down
12 changes: 12 additions & 0 deletions v2/unified-login/multiple-frontends-with-a-single-backend.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,18 @@ class App extends React.Component {

```

:::important
If you are using `useRoutes` or `createBrowserRouter` or have routes defined in a different file, use it in the following way. Please see [this issue](https://github.com/supertokens/supertokens-auth-react/issues/581#issuecomment-1246998493) for further details.
```tsx
const routes = getSuperTokensRoutesForReactRouterDom(reactRouterDom, [OAuth2ProviderPreBuiltUI]);
// createBrowserRouter also works in the following way
const router = useRoutes([
...routes.map(route => route.props),
// Define more routes
])
```
:::

</Answer>

<Answer title="No">
Expand Down
12 changes: 12 additions & 0 deletions v2/unified-login/multiple-frontends-with-separate-backends.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,18 @@ class App extends React.Component {

```

:::important
If you are using `useRoutes` or `createBrowserRouter` or have routes defined in a different file, use it in the following way. Please see [this issue](https://github.com/supertokens/supertokens-auth-react/issues/581#issuecomment-1246998493) for further details.
```tsx
const routes = getSuperTokensRoutesForReactRouterDom(reactRouterDom, [OAuth2ProviderPreBuiltUI]);
// createBrowserRouter also works in the following way
const router = useRoutes([
...routes.map(route => route.props),
// Define more routes
])
```
:::

</Answer>

<Answer title="No">
Expand Down