1.0.4 • Published 5 years ago

nesta v1.0.4

Weekly downloads
2
License
ISC
Repository
github
Last release
5 years ago

nesta

一个迷你状态管理库。

npm version npm downloads

✨ 特性

  • 极简的API,易上手,不依赖前端框架;
  • 利用immer.js实现 immutable state,摆脱麻烦且不可预期的对象和数组展开语法。

📦 安装

npm install nesta
yarn add nesta

🔨 试例

import { createStore } from 'nesta'

const store = createStore({
  data: {
    pageData: [
      {
        id: 7,
        name: 'sheva'
      }
    ]
  }
})

const prevState = store.getState()

store.put(state => {
  state.data.pageData.push({
    id: 22,
    name: 'kaka'
  })
})

const currentState = store.getState()

console.log('prevState: ', prevState)
console.log('currentState: ', currentState)
console.log('prevState === currentState: ,' prevState === currentState)
1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago