Socket
Socket
Sign inDemoInstall

@rpldy/simple-state

Package Overview
Dependencies
Maintainers
1
Versions
86
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rpldy/simple-state

deep proxy object, so it's only updateable through an update method


Version published
Weekly downloads
14K
decreased by-3.91%
Maintainers
1
Weekly downloads
 
Created
Source
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!

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]

FAQs

Package last updated on 08 Jan 2022

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

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