Skip to content

Commit

Permalink
[@xstate/store] Add JSDocs (#4839)
Browse files Browse the repository at this point in the history
* Update JS docs

* Add small example

* Move to store-counter-react

* Update example README.md
  • Loading branch information
davidkpiano committed Apr 9, 2024
1 parent 0ce95c2 commit 4a22edb
Show file tree
Hide file tree
Showing 18 changed files with 2,296 additions and 16 deletions.
5 changes: 5 additions & 0 deletions .changeset/thin-lions-turn.md
@@ -0,0 +1,5 @@
---
'@xstate/store': patch
---

Update JS docs
18 changes: 18 additions & 0 deletions examples/store-counter-react/counter-react/.eslintrc.cjs
@@ -0,0 +1,18 @@
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react-hooks/recommended',
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parser: '@typescript-eslint/parser',
plugins: ['react-refresh'],
rules: {
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
}
24 changes: 24 additions & 0 deletions examples/store-counter-react/counter-react/.gitignore
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
12 changes: 12 additions & 0 deletions examples/store-counter-react/counter-react/README.md
@@ -0,0 +1,12 @@
# Counter example (`@xstate/store`)

This is a simple counter example, built with:

- [XState Store](https://github.com/statelyai/xstate/tree/main/packages/xstate-store)
- React
- TypeScript
- Vite

## [Open in CodeSandbox](https://codesandbox.io/p/sandbox/github/statelyai/xstate/tree/main/examples/store-counter-react)

[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/statelyai/xstate/tree/main/examples/store-counter-react)
13 changes: 13 additions & 0 deletions examples/store-counter-react/counter-react/index.html
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React + TS</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
29 changes: 29 additions & 0 deletions examples/store-counter-react/counter-react/package.json
@@ -0,0 +1,29 @@
{
"name": "counter-react",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
},
"dependencies": {
"@xstate/store": "^0.0.2",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@types/react": "^18.2.66",
"@types/react-dom": "^18.2.22",
"@typescript-eslint/eslint-plugin": "^7.2.0",
"@typescript-eslint/parser": "^7.2.0",
"@vitejs/plugin-react": "^4.2.1",
"eslint": "^8.57.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.6",
"typescript": "^5.2.2",
"vite": "^5.2.0"
}
}

0 comments on commit 4a22edb

Please sign in to comment.