@rpldy/simple-state
TypeScript icon, indicating that this package has built-in type declarations

1.8.0 • Public • Published
npm version circleci status codecov status bundlephobia badge rpldy storybook

Simple State

Internal package

Deep proxies an object so it is only updateable through an update callback. outside an updater, it is impossible to make changes

It only proxies simple objects (not maps or sets) and arrays

It doesnt create new references and doesnt copy over anything

Original object is changed!

The best place to get started is at our: React-Uploady Documentation Website

Installation

#Yarn: 
   $ yarn add @rpldy/simple-state 

#NPM:
   $ npm i @rpldy/simple-state

Important!

All exports of this package are considered internal API and may change/disappear in any version: patch/minor/major

Example

import createState from "@rpldy/simple-state"

const { state, update } = createState({
    arr: [1,2,3]
});

state.arr.push(4);
console.log(state.arr); // print [1,2,3]

update((state) => {
    state.arr.push(4);
});

console.log(state.arr); // print [1,2,3,4]

Readme

Keywords

none

Package Sidebar

Install

npm i @rpldy/simple-state

Weekly Downloads

8,399

Version

1.8.0

License

MIT

Unpacked Size

12.8 kB

Total Files

13

Last publish

Collaborators

  • yoavniran