All Projects β†’ IniZio β†’ Reim

IniZio / Reim

Licence: mit
πŸ€” Handle logic in frontend

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Reim

Model
Angular Model - Simple state management with minimalist API, one way data flow, multiple model support and immutable data exposed as RxJS Observable.
Stars: ✭ 242 (+206.33%)
Mutual labels:  immutable, state-management
Freezer
A tree data structure that emits events on updates, even if the modification is triggered by one of the leaves, making it easier to think in a reactive way.
Stars: ✭ 1,268 (+1505.06%)
Mutual labels:  immutable, state-management
Bistate
A state management library for React combined immutable, mutable and reactive mode
Stars: ✭ 113 (+43.04%)
Mutual labels:  immutable, state-management
grand central
State-management and action-dispatching for Ruby apps
Stars: ✭ 20 (-74.68%)
Mutual labels:  immutable, state-management
vana
Observe your immutable state trees πŸŒ²πŸ‘€ (great with React)
Stars: ✭ 24 (-69.62%)
Mutual labels:  immutable, state-management
zedux
⚑ A high-level, declarative, composable form of Redux https://bowheart.github.io/zedux/
Stars: ✭ 43 (-45.57%)
Mutual labels:  immutable, state-management
dobux
πŸƒ Lightweight responsive state management solution.
Stars: ✭ 75 (-5.06%)
Mutual labels:  immutable, state-management
Easy Peasy
Vegetarian friendly state for React
Stars: ✭ 4,525 (+5627.85%)
Mutual labels:  immutable, state-management
React Context Hook
A React.js global state manager with Hooks
Stars: ✭ 50 (-36.71%)
Mutual labels:  state-management
React Control Center
without redux、mobx and etc, writing react app with react-control-center is a funny way also, it's definitely worth doing! cc is more than a state management framework ^_^
Stars: ✭ 60 (-24.05%)
Mutual labels:  state-management
Royjs
Royjs is only 4.8kb mvvm framework for React
Stars: ✭ 49 (-37.97%)
Mutual labels:  state-management
Raspbernetes
Raspberry Pi Kubernetes Cluster
Stars: ✭ 53 (-32.91%)
Mutual labels:  immutable
React Composition Api
🎨 Simple React state management. Made with @vue/reactivity and ❀️.
Stars: ✭ 67 (-15.19%)
Mutual labels:  state-management
Mount
managing Clojure and ClojureScript app state since (reset)
Stars: ✭ 1,051 (+1230.38%)
Mutual labels:  state-management
Example React Native Redux
react native redux counter example
Stars: ✭ 1,186 (+1401.27%)
Mutual labels:  state-management
Duix
A State Manager focused on KISS and Pareto's Principle
Stars: ✭ 48 (-39.24%)
Mutual labels:  state-management
Moviescatalogflutter
A flutter app sample using different animations with Rx approach Bloc Pattern and Provider
Stars: ✭ 47 (-40.51%)
Mutual labels:  state-management
Flutter Boilerplate Project
A boilerplate project created in flutter using MobX and Provider.
Stars: ✭ 1,194 (+1411.39%)
Mutual labels:  state-management
Immutable Styles
A library for styling web interfaces with a focus on predictability and robustness. It uses immutability to remove side effects often tied to CSS, allowing UI bugs to be caught ahead of time!
Stars: ✭ 69 (-12.66%)
Mutual labels:  immutable
Yewdux
Redux-like state containers for Yew apps
Stars: ✭ 58 (-26.58%)
Mutual labels:  state-management

Reim Β·

πŸ€” Why another state library?

  • 🀘 Update state by simply mutating it, thanks to immer
  • πŸ” Immutable state
  • ⚑️ Small, 6kb gzip + minified
  • 🌟 Typing support for Typescript & Flow
  • βš›οΈ Supports Redux Dev Tools

πŸ“– How to use

$ yarn add reim react-reim

Then use useReim just like other React hooks :

import React from 'react'
import reim from 'reim'
import {useReim} from 'react-reim'

function Counter() {
  const [count, {increment}] = useReim(10, {
    increment: () => state => state++,
    decrement: () => state => state--
  })

  return (
    <div>
      <button onClick={increment}>+</button>
      <div id="count">{count}</div>
    </div>
  )
}

or use <State/> for some cases:

import React from 'react'
import reim from 'reim'
import {State} from 'react-reim'

const Toggle = () => (
  <State
    initial={false}
    actions={{toggle: () => state => !state}}
  >
    {(visible, {toggle}) => (
      <button onClick={toggle}>{visible ? 'On' : 'Off'}</button>
    )}
  </State>
)

Table of Contents

reim

↑ Back to top

reim(state | store, {actions?: Actions, name?: string})

↑ Back to top

Returns a new Reim store.

An action is simple a function that returns a state updater.

For example:

const store = reim({count: 10}, {
  actions: {
    add: amount => state => {state.count += amount}
  }
})

Then just use it as a method:

// before: {count: 10}

store.add(5)

// after: {count: 15}

filter(getter: {[name]: state => any} | state => any | keyof typeof state)

Gets current snapshot of store

subscribe(fn, {filter})

fn gets called on change. You can unsubscribe(fn) to stop subscription.

reim.snapshot()

↑ Back to top

Returns snapshot of all stores created

reim({abc: 133})

reim.snapshot() // -> {0: {abc: 133}}

reim.stringify()

↑ Back to top

Returns JSON.stringify-ed snapshot of all stores created, safe for injecting

reim.preload(snapshot)

↑ Back to top

Used in client side for preloading states

// Server side:
`<script>window.__PRELOAD_STATE__ = ${reim.stringify()}</script>`

// Client side:
reim.preload(window.__PRELOAD_STATE__)

react-reim

↑ Back to top

<State/>

↑ Back to top

initial

↑ Back to top

Initial value of the store. The store is resets if initial value is changed.

store

↑ Back to top

Receives a Reim store, initial is ignored if store is provided

actions

↑ Back to top

Same as actions in reim()

filter

↑ Back to top

Same as filter in reim()

useReim(store | state, {filter, actions})

Returns [snapshot, actions]

❀️ Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

πŸ“ƒ License

MIT Β© IniZio

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].