little-state-machine
Advanced tools
Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "little-state-machine", | ||
"version": "1.0.0", | ||
"main": "index.js", | ||
"repository": "git@github.com:bluebill1049/react-state-machine.git", | ||
"version": "1.0.1", | ||
"main": "dist/index.js", | ||
"module": "dist/index.es.js", | ||
"types": "dist/index.d.ts", | ||
"scripts": { | ||
"clean": "rimraf dist/*", | ||
"build": "rollup -c", | ||
"watch": "tsc --watch", | ||
"release": "npm version", | ||
"postrelease": "yarn publish && git push --follow-tags", | ||
"test": "jest", | ||
"testw": "yarn test -- --watchAll", | ||
"prepublish": "yarn test && yarn run clean && yarn build" | ||
}, | ||
"keywords": [ | ||
"state", | ||
"flux" | ||
], | ||
"repository": "git@github.com:bluebill1049/little-state-machine.git", | ||
"author": "<bluebill1049@hotmail.com>", | ||
"license": "MIT" | ||
"license": "MIT", | ||
"devDependencies": { | ||
"@types/enzyme": "^3.9.0", | ||
"@types/enzyme-adapter-react-16": "^1.0.5", | ||
"@types/jest": "^24.0.11", | ||
"@types/react": "^16.8.8", | ||
"@types/react-test-renderer": "^16.8.1", | ||
"coveralls": "^3.0.3", | ||
"enzyme": "^3.9.0", | ||
"enzyme-adapter-react-16": "^1.9.1", | ||
"jest": "^24.5.0", | ||
"npm-run-all": "^4.1.5", | ||
"react": "^16.8.4", | ||
"react-dom": "^16.8.4", | ||
"react-test-renderer": "^16.8.3", | ||
"rimraf": "^2.6.3", | ||
"rollup": "^1.6.0", | ||
"rollup-plugin-typescript2": "^0.19.2", | ||
"ts-jest": "^24.0.0", | ||
"typescript": "^3.3.3333", | ||
"uglify-es": "^3.3.9" | ||
}, | ||
"peerDependencies": { | ||
"react": "^16.8.0", | ||
"react-dom": "^16.8.0" | ||
} | ||
} |
# little-state-machine | ||
## usage | ||
> Flux state management should be easy | ||
state.js | ||
``` | ||
export default { | ||
name: 'test', | ||
} | ||
``` | ||
[![Tweet](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/intent/tweet?text=Little-State-Machine&url=https://github.com/bluebill1049/little-state-machine) [![npm downloads](https://img.shields.io/npm/dm/little-state-machine.svg?style=flat-square)](https://www.npmjs.com/package/little-state-machine) | ||
[![npm](https://img.shields.io/npm/dt/little-state-machine.svg?style=flat-square)](https://www.npmjs.com/package/little-state-machine) | ||
[![npm](https://img.shields.io/npm/l/little-state-machine.svg?style=flat-square)](https://www.npmjs.com/package/react-lazyload-image) | ||
action.js | ||
``` | ||
function updateName(state, payload) { | ||
return { | ||
...state, | ||
name: payload, | ||
} | ||
} | ||
``` | ||
- Follow flux application architecture | ||
- Tiny and simple | ||
- Build with React Hook | ||
## Install | ||
$ npm install little-state-machine | ||
## Usage | ||
app.js | ||
@@ -26,3 +23,3 @@ ```jsx | ||
import YourComponent from './yourComponent' | ||
import { StateMachineProvider, createStore } from './stateMachine' | ||
import { StateMachineProvider, createStore } from 'little-state-machine' | ||
@@ -47,3 +44,6 @@ createStore({ | ||
```jsx | ||
function YourComponent() { | ||
import { updateName } from './action.js' | ||
import { useStateMachine } from 'little-state-machine' | ||
export default function YourComponent() { | ||
const { | ||
@@ -58,1 +58,18 @@ state: { name }, | ||
``` | ||
state.js | ||
```js | ||
export default { | ||
name: 'test', | ||
} | ||
``` | ||
action.js | ||
```js | ||
export function updateName(state, payload) { | ||
return { | ||
...state, | ||
name: payload, | ||
} | ||
} | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
15558
32
183
73
2
19
1