This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { useState, useTransition } from 'react'; | |
| function App() { | |
| const [name, setName] = useState<string>(''); | |
| const [lists, setLists] = useState<string[]>([]); | |
| const [isPending, startTransition] = useTransition(); | |
| const LIST_SIZE: number = 10000; | |
| const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => { | |
| const { value } = e.target; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { useState } from 'react'; | |
| function App() { | |
| const [name, setName] = useState<string>(''); | |
| const [lists, setLists] = useState<string[]>([]); | |
| const LIST_SIZE: number = 10000; | |
| const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => { | |
| const { value } = e.target; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { useState } from 'react'; | |
| function App() { | |
| const [name, setName] = useState<string>(''); | |
| const [count, setCount] = useState<number>(0); | |
| const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => { | |
| const { value } = e.target; | |
| setName(value); | |
| setCount((prevCount: number) => prevCount + 1); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Suspense, lazy } from 'react'; | |
| import type { RouteObject } from 'react-router'; | |
| import LoadingScreen from './components/LoadingScreen'; | |
| import MainLayout from './layout/MainLayout'; | |
| import AuthGuard from './components/AuthGuard'; | |
| import GuestGuard from './components/GuestGuard'; | |
| const Loadable = (Component: any) => (props: JSX.IntrinsicAttributes) => | |
| ( | |
| <Suspense fallback={<LoadingScreen />}> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import type { FC, ReactNode } from 'react'; | |
| import { Navigate } from 'react-router-dom'; | |
| import PropTypes from 'prop-types'; | |
| import useAuth from '../hooks/useAuth'; | |
| interface GuestGuardProps { | |
| children: ReactNode; | |
| } | |
| const GuestGuard: FC<GuestGuardProps> = ({ children }) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Suspense, lazy } from 'react'; | |
| import type { RouteObject } from 'react-router'; | |
| import LoadingScreen from './components/LoadingScreen'; | |
| import MainLayout from './layout/MainLayout'; | |
| import AuthGuard from './components/AuthGuard'; | |
| const Loadable = (Component: any) => (props: JSX.IntrinsicAttributes) => | |
| ( | |
| <Suspense fallback={<LoadingScreen />}> | |
| <Component {...props} /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import type { FC, ReactNode } from 'react'; | |
| import { useState } from 'react'; | |
| import { Navigate, useLocation } from 'react-router-dom'; | |
| import PropTypes from 'prop-types'; | |
| import useAuth from '../hooks/useAuth'; | |
| import Login from '../pages/authentication/Login'; | |
| interface AuthGuardProps { | |
| children: ReactNode; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import routes from './routes'; | |
| import { useRoutes } from 'react-router-dom'; | |
| const App = () => { | |
| const content = useRoutes(routes); | |
| return content; | |
| }; | |
| export default App; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react'; | |
| import ReactDOM from 'react-dom/client'; | |
| import './index.css'; | |
| import App from './App'; | |
| import reportWebVitals from './reportWebVitals'; | |
| import { BrowserRouter } from 'react-router-dom'; | |
| const root = ReactDOM.createRoot( | |
| document.getElementById('root') as HTMLElement | |
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Suspense, lazy } from 'react'; | |
| import type { RouteObject } from 'react-router'; | |
| import LoadingScreen from './components/LoadingScreen'; | |
| import MainLayout from './layout/MainLayout'; | |
| const Loadable = (Component: any) => (props: JSX.IntrinsicAttributes) => | |
| ( | |
| <Suspense fallback={<LoadingScreen />}> | |
| <Component {...props} /> | |
| </Suspense> |