Initial commit

This commit is contained in:
Joshua Seigler 2022-10-09 17:48:52 -04:00 committed by Joshua Seigler
commit 98ab1bce45
9 changed files with 4868 additions and 0 deletions

17
src/error-page.tsx Normal file
View file

@ -0,0 +1,17 @@
import React from 'react'
import { useRouteError } from 'react-router-dom'
export function ErrorPage() {
const error = useRouteError()
console.error(error)
return (
<div id="error-page">
<h1>Oops!</h1>
<p>Sorry, an unexpected error has occurred.</p>
<p>
<i>{error.statusText || error.message}</i>
</p>
</div>
)
}

12
src/index.html Normal file
View file

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>React State Management</title>
<link rel="stylesheet" href="npm:simpledotcss/simple.min.css" />
</head>
<body>
<div id="app"></div>
<script type="module" src="index.tsx"></script>
</body>
</html>

21
src/index.tsx Normal file
View file

@ -0,0 +1,21 @@
import React from 'react'
import ReactDOM from 'react-dom'
import { createBrowserRouter, RouterProvider } from 'react-router-dom'
import { ErrorPage } from './error-page'
import { Root } from './routes/root'
const router = createBrowserRouter([
{
path: '/',
element: <Root />,
errorElement: <ErrorPage />
}
])
const appEntry = document.getElementById('app')
ReactDOM.render(
<React.StrictMode>
<RouterProvider router={router} />
</React.StrictMode>,
appEntry
)

5
src/routes/root.tsx Normal file
View file

@ -0,0 +1,5 @@
import React from 'react'
export function Root() {
return <h1>React State Management</h1>
}