Skip to content

Commit e3e31e1

Browse files
committed
Initial commit from create-react-router
0 parents  commit e3e31e1

12 files changed

+209
-0
lines changed

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.DS_Store
2+
/node_modules/
3+
4+
# React Router
5+
/.react-router/
6+
/build/

README.md

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Welcome to React Router!
2+
3+
A minimal template for experimenting with React Router v7.
4+
5+
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/remix-run/react-router-templates/tree/main/minimal)
6+
7+
> ![NOTE]
8+
> This template should not be used for production apps and is intended more for experimentation and demo applications. Please see the [default](https://github.com/remix-run/react-router-templates/tree/main/default) template for a more full-featured template.
9+
10+
## Getting Started
11+
12+
### Installation
13+
14+
Install the dependencies:
15+
16+
```bash
17+
npm install
18+
```
19+
20+
### Development
21+
22+
Start the development server with HMR:
23+
24+
```bash
25+
npm run dev
26+
```
27+
28+
Your application will be available at `http://localhost:5173`.
29+
30+
---
31+
32+
Built with ❤️ using React Router.

app/app.css

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@tailwind base;
2+
@tailwind components;
3+
@tailwind utilities;

app/root.tsx

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
import {
2+
isRouteErrorResponse,
3+
Links,
4+
Meta,
5+
Outlet,
6+
Scripts,
7+
ScrollRestoration,
8+
} from "react-router";
9+
10+
import type { Route } from "./+types/root";
11+
import "./app.css";
12+
13+
export function Layout({ children }: { children: React.ReactNode }) {
14+
return (
15+
<html lang="en">
16+
<head>
17+
<meta charSet="utf-8" />
18+
<meta name="viewport" content="width=device-width, initial-scale=1" />
19+
<Meta />
20+
<Links />
21+
</head>
22+
<body>
23+
{children}
24+
<ScrollRestoration />
25+
<Scripts />
26+
</body>
27+
</html>
28+
);
29+
}
30+
31+
export default function App() {
32+
return <Outlet />;
33+
}
34+
35+
export function ErrorBoundary({ error }: Route.ErrorBoundaryProps) {
36+
let message = "Oops!";
37+
let details = "An unexpected error occurred.";
38+
let stack: string | undefined;
39+
40+
if (isRouteErrorResponse(error)) {
41+
message = error.status === 404 ? "404" : "Error";
42+
details =
43+
error.status === 404
44+
? "The requested page could not be found."
45+
: error.statusText || details;
46+
} else if (import.meta.env.DEV && error && error instanceof Error) {
47+
details = error.message;
48+
stack = error.stack;
49+
}
50+
51+
return (
52+
<main className="pt-16 p-4 container mx-auto">
53+
<h1>{message}</h1>
54+
<p>{details}</p>
55+
{stack && (
56+
<pre className="w-full p-4 overflow-x-auto">
57+
<code>{stack}</code>
58+
</pre>
59+
)}
60+
</main>
61+
);
62+
}

app/routes.ts

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { type RouteConfig, index } from "@react-router/dev/routes";
2+
3+
export default [index("routes/home.tsx")] satisfies RouteConfig;

app/routes/home.tsx

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import type { Route } from "./+types/home";
2+
3+
export function loader() {
4+
return { name: "React Router" };
5+
}
6+
7+
export default function Home({ loaderData }: Route.ComponentProps) {
8+
return (
9+
<div className="text-center p-4">
10+
<h1 className="text-2xl">Hello, {loaderData.name}</h1>
11+
<a
12+
className="block mt-2 text-blue-500 underline hover:text-blue-600"
13+
href="https://reactrouter.com/docs"
14+
>
15+
React Router Docs
16+
</a>
17+
</div>
18+
);
19+
}

package.json

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"name": "rr-test",
3+
"private": true,
4+
"type": "module",
5+
"scripts": {
6+
"build": "react-router build",
7+
"dev": "react-router dev",
8+
"start": "react-router-serve ./build/server/index.js",
9+
"typecheck": "react-router typegen && tsc"
10+
},
11+
"dependencies": {
12+
"@react-router/node": "^7.2.0",
13+
"@react-router/serve": "^7.2.0",
14+
"isbot": "^5.1.17",
15+
"react": "^19.0.0",
16+
"react-dom": "^19.0.0",
17+
"react-router": "^7.2.0"
18+
},
19+
"devDependencies": {
20+
"@react-router/dev": "^7.2.0",
21+
"@types/node": "^20",
22+
"@types/react": "^19.0.1",
23+
"@types/react-dom": "^19.0.1",
24+
"tailwindcss": "^3.4.17",
25+
"typescript": "^5.7.2",
26+
"vite": "^6.0.11",
27+
"vite-tsconfig-paths": "^5.1.4"
28+
}
29+
}

public/favicon.ico

14.7 KB
Binary file not shown.

react-router.config.ts

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import type { Config } from "@react-router/dev/config";
2+
3+
export default {
4+
// Config options...
5+
// Server-side render by default, to enable SPA mode set this to `false`
6+
ssr: true,
7+
} satisfies Config;

tailwind.config.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/** @type {import('tailwindcss').Config} */
2+
export default {
3+
content: ["./app/**/*.{ts,tsx}"],
4+
theme: {
5+
extend: {},
6+
},
7+
plugins: [],
8+
};

tsconfig.json

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"include": [
3+
"**/*",
4+
"**/.server/**/*",
5+
"**/.client/**/*",
6+
".react-router/types/**/*"
7+
],
8+
"compilerOptions": {
9+
"lib": ["DOM", "DOM.Iterable", "ES2022"],
10+
"types": ["node", "vite/client"],
11+
"target": "ES2022",
12+
"module": "ES2022",
13+
"moduleResolution": "bundler",
14+
"jsx": "react-jsx",
15+
"rootDirs": [".", "./.react-router/types"],
16+
"baseUrl": ".",
17+
"paths": {
18+
"~/*": ["./app/*"]
19+
},
20+
"esModuleInterop": true,
21+
"verbatimModuleSyntax": true,
22+
"noEmit": true,
23+
"resolveJsonModule": true,
24+
"skipLibCheck": true,
25+
"strict": true
26+
}
27+
}

vite.config.ts

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { reactRouter } from "@react-router/dev/vite";
2+
import tailwindcss from "tailwindcss";
3+
import { defineConfig } from "vite";
4+
import tsconfigPaths from "vite-tsconfig-paths";
5+
6+
export default defineConfig({
7+
css: {
8+
postcss: {
9+
plugins: [tailwindcss],
10+
},
11+
},
12+
plugins: [reactRouter(), tsconfigPaths()],
13+
});

0 commit comments

Comments
 (0)