diff --git a/en/asgardeo/docs/quick-starts/react.md b/en/asgardeo/docs/quick-starts/react.md
index dbb521092d..85ac959d77 100644
--- a/en/asgardeo/docs/quick-starts/react.md
+++ b/en/asgardeo/docs/quick-starts/react.md
@@ -4,13 +4,14 @@ heading: React Quickstart
description: Welcome to the React Quickstart guide! In this document, you will learn to build a React app, add user login and display user profile information using Asgardeo.
what_you_will_learn:
- Create new React app using Vite
- - Install @asgardeo/auth-react package
+ - Install @asgardeo/auth-react package
- Add user login and logout
- Display user profile information
prerequisites:
- About 15 minutes
- Asgardeo account
- - Install a JS package manager
+ - Install Node.js on your system.
+ - Make sure you have a JavaScript package manager like npm
, yarn
, or pnpm
.
- A favorite text editor or IDE
source_code: React Vite App Sample
whats_next:
@@ -44,7 +45,7 @@ Create (a.k.a scaffold) your new React app using Vite.
=== "npm"
- ``` bash
+ ```bash
npm create vite@latest asgardeo-react -- --template react
cd asgardeo-react
@@ -56,26 +57,26 @@ Create (a.k.a scaffold) your new React app using Vite.
=== "yarn"
- ``` bash
+ ```bash
yarn create vite@latest asgardeo-react -- --template react
cd asgardeo-react
- yran install
+ yarn install
yarn dev
```
=== "pnpm"
- ``` bash
+ ```bash
pnpm create vite@latest asgardeo-react -- --template react
cd asgardeo-react
pnpm install
- pnpm run dev
+ pnpm dev
```
## Install @asgardeo/auth-react
@@ -84,19 +85,19 @@ Asgardeo React SDK provides all the components and hooks you need to integrate A
=== "npm"
- ``` bash
+ ```bash
npm install @asgardeo/auth-react
```
=== "yarn"
- ``` bash
+ ```bash
yarn add @asgardeo/auth-react
```
=== "pnpm"
- ``` bash
+ ```bash
pnpm add @asgardeo/auth-react
```
@@ -113,29 +114,28 @@ Add the following changes to the `main.jsx` file.
- ``
- `https://api.asgardeo.io/t/`
-```javascript
-import React from 'react';
-import ReactDOM from 'react-dom/client';
-import App from './App.jsx';
-import { AuthProvider } from '@asgardeo/auth-react';
-import './index.css';
-
-const config = {
- signInRedirectURL: "http://localhost:5173",
- signOutRedirectURL: "http://localhost:5173",
- clientID: "",
- baseUrl: "https://api.asgardeo.io/t/",
- scope: [ "openid","profile" ]
-}
-
-ReactDOM.createRoot(document.getElementById('root')).render(
-
-
-
-
- ,
-);
-
+```javascript hl_lines="5 9-17 19"
+import { StrictMode } from 'react'
+import { createRoot } from 'react-dom/client'
+import './index.css'
+import App from './App.jsx'
+import { AuthProvider } from '@asgardeo/auth-react'
+
+createRoot(document.getElementById('root')).render(
+
+ ',
+ baseUrl: 'https://api.asgardeo.io/t/',
+ scope: ['openid', 'profile'],
+ } }
+ >
+
+
+
+)
```
## Add login and logout link to your app
@@ -144,25 +144,25 @@ Asgardeo provides `useAuthContext` hook to conveniently access user authenticati
Replace the existing content of the `App.jsx` file with following content.
-```javascript
-import { useAuthContext } from "@asgardeo/auth-react";
-import './App.css';
+```javascript hl_lines="1 5 9-13"
+import { useAuthContext } from '@asgardeo/auth-react'
+import './App.css'
-const App = () => {
-const { state, signIn, signOut } = useAuthContext();
+function App() {
+ const { state, signIn, signOut } = useAuthContext();
-return (
+ return (
<>
- {
- state.isAuthenticated
- ?
- :
- }
+ {state.isAuthenticated ? (
+
+ ) : (
+
+ )}
>
-)
-};
+ )
+}
-export default App;
+export default App
```
Visit your app's homepage at [http://localhost:5173](http://localhost:5173).
@@ -173,27 +173,28 @@ Visit your app's homepage at [http://localhost:5173](http://localhost:5173).
## Display logged in user details
-Modified the code as below to see logged in user details.
+Modify the code as below to see logged in user details.
-```javascript
-...
+```javascript hl_lines="11"
+import { useAuthContext } from '@asgardeo/auth-react'
+import './App.css'
-const App = () => {
-...
+function App() {
+ const { state, signIn, signOut } = useAuthContext();
-return (
+ return (
<>
- {
- state.isAuthenticated ?
- <>
- Welcome {state.username}
-
- >
- :
- }
+ {state.isAuthenticated ? (
+ <>
+ Welcome {state.username}
+
+ >
+ ) : (
+
+ )}
>
-)
-};
+ )
+}
-...
+export default App
```
diff --git a/en/identity-server/7.0.0/docs/quick-starts/react.md b/en/identity-server/7.0.0/docs/quick-starts/react.md
index 0bdc5cdf45..e334853495 100644
--- a/en/identity-server/7.0.0/docs/quick-starts/react.md
+++ b/en/identity-server/7.0.0/docs/quick-starts/react.md
@@ -4,13 +4,14 @@ heading: React Quickstart
description: Welcome to the React Quickstart guide! In this document, you will learn to build a React app, add user login and display user profile information using WSO2 Identity Server.
what_you_will_learn:
- Create new React app using Vite
- - Install @asgardeo/auth-react package
+ - Install @asgardeo/auth-react package
- Add user login and logout
- Display user profile information
prerequisites:
- About 15 minutes
- Set-up WSO2 Identity Server
- - Install a JS package manager
+ - Install Node.js on your system.
+ - Make sure you have a JavaScript package manager like npm
, yarn
, or pnpm
.
- A favorite text editor or IDE
source_code: React Vite App Sample
whats_next:
@@ -44,7 +45,7 @@ Create (a.k.a scaffold) your new React app using Vite.
=== "npm"
- ``` bash
+ ```bash
npm create vite@latest is-react -- --template react
cd is-react
@@ -56,26 +57,26 @@ Create (a.k.a scaffold) your new React app using Vite.
=== "yarn"
- ``` bash
+ ```bash
yarn create vite@latest is-react -- --template react
cd is-react
- yran install
+ yarn install
yarn dev
```
=== "pnpm"
- ``` bash
+ ```bash
pnpm create vite@latest is-react -- --template react
cd is-react
pnpm install
- pnpm run dev
+ pnpm dev
```
## Install @asgardeo/auth-react
@@ -84,19 +85,19 @@ Asgardeo React SDK provides all the components and hooks you need to integrate A
=== "npm"
- ``` bash
+ ```bash
npm install @asgardeo/auth-react
```
=== "yarn"
- ``` bash
+ ```bash
yarn add @asgardeo/auth-react
```
=== "pnpm"
- ``` bash
+ ```bash
pnpm add @asgardeo/auth-react
```
@@ -120,29 +121,28 @@ Add the following changes to the `main.jsx` file.
- ``
-```javascript
-import React from 'react';
-import ReactDOM from 'react-dom/client';
-import App from './App.jsx';
-import { AuthProvider } from '@asgardeo/auth-react';
-import './index.css';
-
-const config = {
- signInRedirectURL: "http://localhost:5173",
- signOutRedirectURL: "http://localhost:5173",
- clientID: "",
- baseUrl: "https://localhost:9443",
- scope: [ "openid","profile" ]
-}
-
-ReactDOM.createRoot(document.getElementById('root')).render(
-
-
-
-
- ,
-);
-
+```javascript hl_lines="5 9-17 19"
+import { StrictMode } from 'react'
+import { createRoot } from 'react-dom/client'
+import './index.css'
+import App from './App.jsx'
+import { AuthProvider } from '@asgardeo/auth-react'
+
+createRoot(document.getElementById('root')).render(
+
+ ',
+ baseUrl: 'https://localhost:9443',
+ scope: ['openid', 'profile'],
+ } }
+ >
+
+
+
+)
```
## Add login and logout link to your app
@@ -151,25 +151,25 @@ Asgardeo React SDK provides `useAuthContext` hook to conveniently access user au
Replace the existing content of the `App.jsx` file with following content.
-```javascript
-import { useAuthContext } from "@asgardeo/auth-react";
-import './App.css';
+```javascript hl_lines="1 5 9-13"
+import { useAuthContext } from '@asgardeo/auth-react'
+import './App.css'
-const App = () => {
-const { state, signIn, signOut } = useAuthContext();
+function App() {
+ const { state, signIn, signOut } = useAuthContext();
-return (
+ return (
<>
- {
- state.isAuthenticated
- ?
- :
- }
+ {state.isAuthenticated ? (
+
+ ) : (
+
+ )}
>
-)
-};
+ )
+}
-export default App;
+export default App
```
Visit your app's homepage at [http://localhost:5173](http://localhost:5173).
@@ -180,27 +180,28 @@ Visit your app's homepage at [http://localhost:5173](http://localhost:5173).
## Display logged in user details
-Modified the code as below to see logged in user details.
+Modify the code as below to see logged in user details.
-```javascript
-...
+```javascript hl_lines="11"
+import { useAuthContext } from '@asgardeo/auth-react'
+import './App.css'
-const App = () => {
-...
+function App() {
+ const { state, signIn, signOut } = useAuthContext();
-return (
+ return (
<>
- {
- state.isAuthenticated ?
- <>
- Welcome {state.username}
-
- >
- :
- }
+ {state.isAuthenticated ? (
+ <>
+ Welcome {state.username}
+
+ >
+ ) : (
+
+ )}
>
-)
-};
+ )
+}
-...
+export default App
```