Skip to content

Commit

Permalink
Feat: starter example (#1021)
Browse files Browse the repository at this point in the history
* feat: starter example

* fix: remove unused asset

* fix: (starter-example) remove jotai reference

* fix: small refinements

---------

Co-authored-by: Daishi Kato <[email protected]>
  • Loading branch information
leweyse and dai-shi authored Dec 28, 2024
1 parent 0e7975b commit 00e8bdc
Show file tree
Hide file tree
Showing 11 changed files with 1,066 additions and 0 deletions.
1 change: 1 addition & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Simple examples

* [Starter](https://github.com/pmndrs/valtio/tree/main/examples/starter)
* [Counter](https://github.com/pmndrs/valtio/tree/main/examples/counter)
* [Todo](https://github.com/pmndrs/valtio/tree/main/examples/todo)
* [Todo with proxyMap](https://github.com/pmndrs/valtio/tree/main/examples/todo-with-proxyMap)
20 changes: 20 additions & 0 deletions examples/starter/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Starter [![Open in StackBlitz](https://img.shields.io/badge/Open%20in-StackBlitz-blue?style=flat-square&logo=stackblitz)](https://stackblitz.com/github/pmndrs/valtio/tree/main/examples/starter)

## Set up locally

```bash
git clone https://github.com/pmndrs/valtio

# install project dependencies & build the library
cd valtio && pnpm install

# move to the examples folder & install dependencies
cd examples/starter && pnpm install

# start the dev server
pnpm dev
```

## Set up on `StackBlitz`

Link: https://stackblitz.com/github/pmndrs/valtio/tree/main/examples/starter
15 changes: 15 additions & 0 deletions examples/starter/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="valtio examples" />
<title>Valtio Examples | Starter</title>
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/index.tsx"></script>
</body>
</html>
23 changes: 23 additions & 0 deletions examples/starter/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "starter",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"preview": "vite preview"
},
"dependencies": {
"valtio": "^2.1.2",
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
"devDependencies": {
"@types/react": "^18.2.0",
"@types/react-dom": "^18.2.0",
"@vitejs/plugin-react-swc": "^3.5.0",
"typescript": "^5.0.0",
"vite": "^5.3.4"
}
}
Loading

0 comments on commit 00e8bdc

Please sign in to comment.