tidux
Fast, small state management lib for React
Features
- No store needed
- No Provider needed
- No reducer needed
- No action types needed
- Fluently state mutating, just assign new values to writable variables
- Simple API: subscribe, dispatch, useSelector
- Handling future action dispatching easily
- Support cancellable async dispatching
- Best for code splitting
Basic Counter
import React from "react";import dispatch useSelector from "tidux"; let $count = 0;const Increase = $count++;const App = const count = ; return <> <h1>count</h1> <button =>Increase</button> </> ;;
Async Counter
import React from "react";import dispatch useSelector delay from "tidux"; let $count = 0;const Increase = await ; $count++;;const App = const count = ; return <> <h1>count</h1> <button =>Increase</button> </> ;;
Calling another action inside current action (unsafe way)
import React from "react";import dispatch useSelector delay from "tidux"; let $count = 0;const Increase = $count++;const IncreaseAsync = await ; ;;const App = const count = ; return <> <h1>count</h1> <button =>Increase</button> <button =>Increase Async</button> </> ;;
Calling another action inside current action (safe way)
import React from "react";import dispatch useSelector from "tidux"; let $count = 0;const Increase = $count++;const IncreaseAsync = await ; ;;const App = const count = ; return <> <h1>count</h1> <button =>Increase</button> <button =>Increase Async</button> </> ;;