New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

nesta

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nesta

A mini state container for JavaScript apps

latest
Source
npmnpm
Version
1.0.4
Version published
Maintainers
1
Created
Source

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)

Keywords

state

FAQs

Package last updated on 28 Jan 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts