0.4.8 • Published 6 months ago

schummar-state v0.4.8

Weekly downloads
73
License
ISC
Repository
github
Last release
6 months ago

npm badge bundlephobia badge

Lighweight React hooks based state library. Heavily inspired by pullstate

Getting started

Install

npm install schummar-state

Create a store

import { Store } from 'schummar-state';

export const store = new Store({
  counter: 0,
});

You can easily use multiple stores in parallel.

Use store in a component

import store from './store.ts';

export function App() {
  const counter = store.useState((state) => state.counter);

  return (
    <div>
      <div>Counter: {counter}</div>
    </div>
  );
}

Update a store

import store from './store.ts';

export function App() {
  const counter = store.useState((state) => state.counter);

  const increment = () =>
    store.update((state) => {
      state.counter++;
    });

  return (
    <div>
      <div>Counter: {counter}</div>
      <button onClick={increment}>Increment</button>
    </div>
  );
}
0.4.8

6 months ago

0.5.4

1 year ago

0.5.0

1 year ago

0.5.2

1 year ago

0.5.1

1 year ago

0.4.7

1 year ago

0.4.5

2 years ago

0.4.6

2 years ago

0.4.4

2 years ago

0.4.1

2 years ago

0.4.0

2 years ago

0.4.3

2 years ago

0.4.2

2 years ago

0.3.0

2 years ago

0.3.1

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.2.2

2 years ago

0.1.3

2 years ago

0.1.2

3 years ago

0.1.0

3 years ago

0.0.40

3 years ago

0.0.39

3 years ago

0.0.38

3 years ago

0.0.37

3 years ago

0.0.36

3 years ago

0.0.32

3 years ago

0.0.33

3 years ago

0.0.34

3 years ago

0.0.35

3 years ago

0.0.30

3 years ago

0.0.31

3 years ago

0.0.29

3 years ago

0.0.23

3 years ago

0.0.24

3 years ago

0.0.25

3 years ago

0.0.26

3 years ago

0.0.27

3 years ago

0.0.28

3 years ago

0.0.20

3 years ago

0.0.21

3 years ago

0.0.22

3 years ago

0.0.19

3 years ago

0.0.18

3 years ago

0.0.17

3 years ago

0.0.16

3 years ago

0.0.15

3 years ago

0.0.14

3 years ago

0.0.13

3 years ago

0.0.11

3 years ago

0.0.12

3 years ago

0.0.10

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.6

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago