Socket
Socket
Sign inDemoInstall

little-state-machine

Package Overview
Dependencies
Maintainers
1
Versions
210
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

little-state-machine - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

.rpt2_cache/rpt2_6b9edc7ec02678ec4bd272cefd74aa5bf5c51076/code/cache/2a7e90ddf87f04288ae74fa845808446072d7ca8

49

package.json
{
"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"
}
}

53

README.md
# 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)&nbsp; [![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,
}
}
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc