tinux
150 lines state management for React
Codesandbox
Sample Counter Appimport React from "react";import tinux from "tinux";import "./styles.css"; const delay = ;// create store with initial stateconst store = ;// define actionsconst Increase = ...state count: statecount + 1 ;const Decrease = ...state count: statecount - 1 ;const Noop = ;const AppendLog = state payload ...state logs: statelogs;const IncreaseAsync = await ; ;;// define flows.const LogFlow = state dispatch ;;const StartupFlow = // log action dispatching ; ; // continuous future action handling while true const payload = await ; ; ;const CountValidation = state revert if < 0 ; ;// define selectorsconst CountSelector = statecount;const LogsSelector = statelogs; store;store; { // no hook needed const count logs = store; const handleNoop = store; const handleIncrease = store; const handleDecrease = store; const handleIncreaseAsync = store; return <div ="App"> <h1>count</h1> <button =>Increase</button> <button =></button> <button =>Decrease</button> <button =>Noop</button> <xmp>logs</xmp> </div> ;}