Socket
Socket
Sign inDemoInstall

simpler-state

Package Overview
Dependencies
Maintainers
1
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simpler-state

The simplest app state management for React


Version published
Weekly downloads
60K
increased by1.66%
Maintainers
1
Weekly downloads
 
Created
Source

SimpleR State

npm build coverage license

SimpleR State is an ultra-lightweight library that provides the simplest state management for React.

It is part of the upcoming SimpleR collection of all things that make React development a breeze. This library is an evolution of React Entities.

Two Easy Steps!

Step 1: Create an entity (shared state) and actions

const counter = entity(0)

const increment = by => {
  counter.set(counter.get() + by)
}

const decrement = by => {
  counter.set(counter.get() - by)
}

Step 2: Use the entity in your components

const CounterView = () => {
  const count = useEntity(counter)

  return (
    <>
      <div>{count}</div>

      <button onClick={() => increment(1)}> + </button> 
      <button onClick={() => decrement(1)}> - </button>
    </>
  )
}

It's that simple!

Keywords

FAQs

Package last updated on 08 Mar 2021

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