Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

examples: migrate to vite #211

Merged
merged 2 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 16 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,7 @@ that provide useSelector-like hooks.
This package requires some peer dependencies, which you need to install by yourself.

```bash
yarn add react-tracked react scheduler react-dom
```

For React Native users:

```bash
yarn add react-tracked react scheduler react-native
npm add react-tracked react scheduler
```

## Usage
Expand Down Expand Up @@ -231,25 +225,25 @@ The [examples](examples) folder contains working examples.
You can run one of them with

```bash
PORT=8080 yarn run examples:01_minimal
PORT=8080 pnpm run examples:01_minimal
```

and open <http://localhost:8080> in your web browser.

You can also try them in codesandbox.io:
[01](https://codesandbox.io/s/github/dai-shi/react-tracked/tree/main/examples/01_minimal)
[02](https://codesandbox.io/s/github/dai-shi/react-tracked/tree/main/examples/02_typescript)
[03](https://codesandbox.io/s/github/dai-shi/react-tracked/tree/main/examples/03_usestate)
[04](https://codesandbox.io/s/github/dai-shi/react-tracked/tree/main/examples/04_selector)
[05](https://codesandbox.io/s/github/dai-shi/react-tracked/tree/main/examples/05_container)
[06](https://codesandbox.io/s/github/dai-shi/react-tracked/tree/main/examples/06_customhook)
[07](https://codesandbox.io/s/github/dai-shi/react-tracked/tree/main/examples/07_todolist)
[08](https://codesandbox.io/s/github/dai-shi/react-tracked/tree/main/examples/08_comparison)
[09](https://codesandbox.io/s/github/dai-shi/react-tracked/tree/main/examples/09_reactmemo)
[10](https://codesandbox.io/s/github/dai-shi/react-tracked/tree/main/examples/10_untracked)
[11](https://codesandbox.io/s/github/dai-shi/react-tracked/tree/main/examples/11_form)
[12](https://codesandbox.io/s/github/dai-shi/react-tracked/tree/main/examples/12_async)
[13](https://codesandbox.io/s/github/dai-shi/react-tracked/tree/main/examples/13_saga)
You can also try them directly:
[01](https://stackblitz.com/github/dai-shi/react-tracked/tree/main/examples/01_minimal)
[02](https://stackblitz.com/github/dai-shi/react-tracked/tree/main/examples/02_typescript)
[03](https://stackblitz.com/github/dai-shi/react-tracked/tree/main/examples/03_usestate)
[04](https://stackblitz.com/github/dai-shi/react-tracked/tree/main/examples/04_selector)
[05](https://stackblitz.com/github/dai-shi/react-tracked/tree/main/examples/05_container)
[06](https://stackblitz.com/github/dai-shi/react-tracked/tree/main/examples/06_customhook)
[07](https://stackblitz.com/github/dai-shi/react-tracked/tree/main/examples/07_todolist)
[08](https://stackblitz.com/github/dai-shi/react-tracked/tree/main/examples/08_comparison)
[09](https://stackblitz.com/github/dai-shi/react-tracked/tree/main/examples/09_reactmemo)
[10](https://stackblitz.com/github/dai-shi/react-tracked/tree/main/examples/10_untracked)
[11](https://stackblitz.com/github/dai-shi/react-tracked/tree/main/examples/11_form)
[12](https://stackblitz.com/github/dai-shi/react-tracked/tree/main/examples/12_async)
[13](https://stackblitz.com/github/dai-shi/react-tracked/tree/main/examples/13_saga)

## Benchmarks

Expand Down
9 changes: 9 additions & 0 deletions examples/01_counter/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<html>
<head>
<title>example</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
19 changes: 9 additions & 10 deletions examples/01_counter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,19 @@
"name": "example",
"version": "0.0.0",
"private": true,
"type": "commonjs",
"type": "module",
"dependencies": {
"@types/react": "latest",
"@types/react-dom": "latest",
"react": "latest",
"react-dom": "latest",
"react-scripts": "latest",
"react-tracked": "latest",
"typescript": "latest"
"react-tracked": "latest"
},
"devDependencies": {
"@types/react": "latest",
"@types/react-dom": "latest",
"typescript": "latest",
"vite": "latest"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
"dev": "vite"
}
}
8 changes: 0 additions & 8 deletions examples/01_counter/public/index.html

This file was deleted.

13 changes: 0 additions & 13 deletions examples/01_counter/src/index.tsx

This file was deleted.

10 changes: 10 additions & 0 deletions examples/01_counter/src/main.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';

import App from './app';

createRoot(document.getElementById('root')!).render(
<StrictMode>
<App />
</StrictMode>,
);
14 changes: 14 additions & 0 deletions examples/01_counter/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"compilerOptions": {
"strict": true,
"target": "es2018",
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"skipLibCheck": true,
"allowJs": true,
"noUncheckedIndexedAccess": true,
"exactOptionalPropertyTypes": true,
"jsx": "react-jsx"
}
}
9 changes: 9 additions & 0 deletions examples/02_person/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<html>
<head>
<title>example</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
19 changes: 9 additions & 10 deletions examples/02_person/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,19 @@
"name": "example",
"version": "0.0.0",
"private": true,
"type": "commonjs",
"type": "module",
"dependencies": {
"@types/react": "latest",
"@types/react-dom": "latest",
"react": "latest",
"react-dom": "latest",
"react-scripts": "latest",
"react-tracked": "latest",
"typescript": "latest"
"react-tracked": "latest"
},
"devDependencies": {
"@types/react": "latest",
"@types/react-dom": "latest",
"typescript": "latest",
"vite": "latest"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
"dev": "vite"
}
}
8 changes: 0 additions & 8 deletions examples/02_person/public/index.html

This file was deleted.

13 changes: 0 additions & 13 deletions examples/02_person/src/index.tsx

This file was deleted.

10 changes: 10 additions & 0 deletions examples/02_person/src/main.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';

import App from './app';

createRoot(document.getElementById('root')!).render(
<StrictMode>
<App />
</StrictMode>,
);
14 changes: 14 additions & 0 deletions examples/02_person/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"compilerOptions": {
"strict": true,
"target": "es2018",
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"skipLibCheck": true,
"allowJs": true,
"noUncheckedIndexedAccess": true,
"exactOptionalPropertyTypes": true,
"jsx": "react-jsx"
}
}
9 changes: 9 additions & 0 deletions examples/03_usestate/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<html>
<head>
<title>example</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
19 changes: 9 additions & 10 deletions examples/03_usestate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,19 @@
"name": "example",
"version": "0.0.0",
"private": true,
"type": "commonjs",
"type": "module",
"dependencies": {
"@types/react": "latest",
"@types/react-dom": "latest",
"react": "latest",
"react-dom": "latest",
"react-scripts": "latest",
"react-tracked": "latest",
"typescript": "latest"
"react-tracked": "latest"
},
"devDependencies": {
"@types/react": "latest",
"@types/react-dom": "latest",
"typescript": "latest",
"vite": "latest"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
"dev": "vite"
}
}
8 changes: 0 additions & 8 deletions examples/03_usestate/public/index.html

This file was deleted.

13 changes: 0 additions & 13 deletions examples/03_usestate/src/index.tsx

This file was deleted.

10 changes: 10 additions & 0 deletions examples/03_usestate/src/main.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';

import App from './app';

createRoot(document.getElementById('root')!).render(
<StrictMode>
<App />
</StrictMode>,
);
14 changes: 14 additions & 0 deletions examples/03_usestate/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"compilerOptions": {
"strict": true,
"target": "es2018",
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"skipLibCheck": true,
"allowJs": true,
"noUncheckedIndexedAccess": true,
"exactOptionalPropertyTypes": true,
"jsx": "react-jsx"
}
}
9 changes: 9 additions & 0 deletions examples/04_selector/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<html>
<head>
<title>example</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
19 changes: 9 additions & 10 deletions examples/04_selector/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,19 @@
"name": "example",
"version": "0.0.0",
"private": true,
"type": "commonjs",
"type": "module",
"dependencies": {
"@types/react": "latest",
"@types/react-dom": "latest",
"react": "latest",
"react-dom": "latest",
"react-scripts": "latest",
"react-tracked": "latest",
"typescript": "latest"
"react-tracked": "latest"
},
"devDependencies": {
"@types/react": "latest",
"@types/react-dom": "latest",
"typescript": "latest",
"vite": "latest"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
"dev": "vite"
}
}
8 changes: 0 additions & 8 deletions examples/04_selector/public/index.html

This file was deleted.

13 changes: 0 additions & 13 deletions examples/04_selector/src/index.tsx

This file was deleted.

10 changes: 10 additions & 0 deletions examples/04_selector/src/main.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';

import App from './app';

createRoot(document.getElementById('root')!).render(
<StrictMode>
<App />
</StrictMode>,
);
Loading
Loading