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 - npm Package Compare versions

Comparing version 1.0.0-beta.2 to 1.0.0-beta.3

2

index.d.ts

@@ -5,3 +5,3 @@ export function entity<T = any>(initialValue: T): Entity<T>

entity: Entity<T>,
options: {
options?: {
transform?: (value: T) => C

@@ -8,0 +8,0 @@ equalityFn?: (a: any, b: any) => boolean

{
"name": "simpler-state",
"version": "1.0.0-beta.2",
"version": "1.0.0-beta.3",
"description": "The simplest app state management for React",

@@ -5,0 +5,0 @@ "keywords": [

@@ -10,16 +10,20 @@ # SimpleR State

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__](https://github.com/arnelenero/react-entities).
This library is an evolution of [__React Entities__](https://github.com/arnelenero/react-entities).
## Two Easy Steps!
__Step 1:__ Create an entity (shared state) and actions
__Step 1:__ Create an entity (shared state) and actions (updater functions)
```js
const counter = entity(0)
// counter.js
const increment = by => {
import { entity } from 'simpler-state'
export const counter = entity(0)
export const increment = by => {
counter.set(counter.get() + by)
}
const decrement = by => {
export const decrement = by => {
counter.set(counter.get() - by)

@@ -29,5 +33,8 @@ }

__Step 2:__ Use the entity in your components
__Step 2:__ Use the entity in your components with hooks
```jsx
import { useEntity } from 'simpler-state'
import { counter, increment, decrement } from 'counter'
const CounterView = () => {

@@ -47,2 +54,2 @@ const count = useEntity(counter)

It's that simple!
It's that simple!
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