All Projects → wellguimaraes → stateware

wellguimaraes / stateware

Licence: MIT license
Smart state container with easy copy and auto memoized getters

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to stateware

react-globally
Gives you setGlobalState, so you can set state globally
Stars: ✭ 22 (+10%)
Mutual labels:  state
dipa
dipa makes it easy to efficiently delta encode large Rust data structures.
Stars: ✭ 243 (+1115%)
Mutual labels:  state
ngx-online-status
🔛 Angular 5+ Detect online/offline state
Stars: ✭ 23 (+15%)
Mutual labels:  state
Reamp
A painkiller for your Android apps
Stars: ✭ 51 (+155%)
Mutual labels:  state
react-state
React-State - Superpowers for managing local and reusable state in React
Stars: ✭ 14 (-30%)
Mutual labels:  state
csc picker
A flutter package to display a country, states, and cities. In addition it gives the possibility to select a list of countries, States and Cities depends on Selected, also you can search country, state, and city all around the world.
Stars: ✭ 25 (+25%)
Mutual labels:  state
oh-my-design-patterns
🎨 Record the articles and code I wrote while learning design patterns
Stars: ✭ 33 (+65%)
Mutual labels:  state
lombok-rs
Lombok port for Rust
Stars: ✭ 31 (+55%)
Mutual labels:  getters
react-native-easy-state-view
Fully customizable State View for React Native.
Stars: ✭ 21 (+5%)
Mutual labels:  state
StateBuilder
State machine code generator for C++ and Java.
Stars: ✭ 30 (+50%)
Mutual labels:  state
substate
pub/sub state management with optional deep cloning
Stars: ✭ 15 (-25%)
Mutual labels:  state
SuperGrate
💾 Get moving with Super Grate; a free & open source Windows Profile Migration & Backup Utility. Super Grate is a GUI (Graphical User Interface) that assists Microsoft's USMT (User State Migration Utility) in performing remote migrations over a network connection.
Stars: ✭ 91 (+355%)
Mutual labels:  state
ballotnav
A repository for HackforLA's BallotNav project
Stars: ✭ 21 (+5%)
Mutual labels:  state
enform
Handle React forms with joy 🍿
Stars: ✭ 38 (+90%)
Mutual labels:  state
storken
🦩 Storken is a React State Manager. Simple as `useState`.
Stars: ✭ 22 (+10%)
Mutual labels:  state
hyperapp-example
hyperapp example
Stars: ✭ 14 (-30%)
Mutual labels:  state
react-redux-modals
This repo created for Medium.com: React/Redux: Modals and Dialogs
Stars: ✭ 30 (+50%)
Mutual labels:  state
XUI
XUI makes modular, testable architectures for SwiftUI apps a breeze!
Stars: ✭ 100 (+400%)
Mutual labels:  state
atomic-state
Atomic State is a state management library for React
Stars: ✭ 15 (-25%)
Mutual labels:  state
React-Machinery
🔥 React Machinery provides a simple to use, component based approach to state machines in react.
Stars: ✭ 104 (+420%)
Mutual labels:  state

Actionware

A fast, dependency-free state container with easy copy and automagically memoized getters, designed for immutability.

Extra power

Wanna reduce Redux boilerplate? Use it combined with Actionware lib.

Install it

npm i stateware --save

yarn add stateware

Use it

import { createState } from 'stateware'

const initialState = createState({
  users: [],
  genderFilter: null,
  
  filteredUsers({ users, genderFilter }) {
    return users.filter(user => !genderFilter || user.gender === genderFilter);
  },
  
  totalPosts({ filteredUsers }) {
    return filteredUsers.reduce((sum, user) => sum + user.postsCount, 0);
  }
})

// Create a new state, updating 'users' value
const newState = initialState.copy({
  users: [
    { name: 'John Doe'     , gender: 'M', postsCount: 10 },
    { name: 'Jane Doe'     , gender: 'F', postsCount: 5 },
    { name: 'Alan Turing'  , gender: 'M', postsCount: 15 },
    { name: 'Ada Lovelace' , gender: 'F', postsCount: 16 }
  ]
})

// Access state values
newState.users
newState.genderFilter
newState.filteredUsers
newState.totalPosts

Usage with Redux

Do this:

switch (action.type) {
  case 'SET_GENDER_FILTER':
    return state.copy({
      genderFilter: action.payload
    })
}

Instead of:

switch (action.type) {
  case 'SET_GENDER_FILTER':
    const filter = action.payload
    
    return {
      ...state,
      genderFilter: filter,
      filteredUsers: state.users.filter(user => !filter || user.gender === filter)
    }
}

License

MIT © Wellington Guimaraes

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].