-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
74 additions
and
25 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,9 @@ | ||
import { useState } from 'react'; | ||
import reactLogo from './assets/react.svg'; | ||
import { RouterProvider } from 'react-router-dom'; | ||
import './App.css'; | ||
import router from './router'; | ||
|
||
function App() { | ||
const [count, setCount] = useState(0); | ||
|
||
return ( | ||
<div className="App"> | ||
<div> | ||
<a href="https://vitejs.dev" target="_blank" rel="noreferrer"> | ||
<img src="/vite.svg" className="logo" alt="Vite logo" /> | ||
</a> | ||
<a href="https://reactjs.org" target="_blank" rel="noreferrer"> | ||
<img src={reactLogo} className="logo react" alt="React logo" /> | ||
</a> | ||
</div> | ||
<h1>Vite + React</h1> | ||
<div className="card"> | ||
<button onClick={() => setCount((count) => count + 1)}>count is {count}</button> | ||
<p> | ||
Edit <code>src/App.tsx</code> and save to test HMR | ||
</p> | ||
</div> | ||
<p className="read-the-docs">Click on the Vite and React logos to learn more</p> | ||
</div> | ||
); | ||
return <RouterProvider router={router} />; | ||
} | ||
|
||
export default App; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { lazy } from 'react'; | ||
import { createBrowserRouter } from 'react-router-dom'; | ||
|
||
const Home = lazy(() => import('@/views/Home')); | ||
const ErrorPage403 = lazy(() => import('@/views/error/403')); | ||
|
||
export default createBrowserRouter([ | ||
{ | ||
path: '/', | ||
element: <Home />, | ||
errorElement: <ErrorPage403 />, | ||
}, | ||
]); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { useState } from 'react'; | ||
import reactLogo from '@/assets/react.svg'; | ||
|
||
const Home = () => { | ||
const [count, setCount] = useState(0); | ||
|
||
const render = () => { | ||
return ( | ||
<div className="App"> | ||
<div> | ||
<a href="https://vitejs.dev" target="_blank" rel="noreferrer"> | ||
<img src="/vite.svg" className="logo" alt="Vite logo" /> | ||
</a> | ||
<a href="https://reactjs.org" target="_blank" rel="noreferrer"> | ||
<img src={reactLogo} className="logo react" alt="React logo" /> | ||
</a> | ||
</div> | ||
<h1>Vite + React</h1> | ||
<div className="card"> | ||
<button onClick={() => setCount((count) => count + 1)}>count is {count}</button> | ||
<p> | ||
Edit <code>src/App.tsx</code> and save to test HMR | ||
</p> | ||
</div> | ||
<p className="read-the-docs">Click on the Vite and React logos to learn more</p> | ||
</div> | ||
); | ||
}; | ||
|
||
return render(); | ||
}; | ||
|
||
export default Home; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export default () => { | ||
const render = () => { | ||
return <>403</>; | ||
}; | ||
|
||
return render(); | ||
}; |
This file contains 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
This file contains 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