https://github.com/remorses/f-redux
Manage global shared state easily via hooks
https://github.com/remorses/f-redux
Last synced: 7 months ago
JSON representation
Manage global shared state easily via hooks
- Host: GitHub
- URL: https://github.com/remorses/f-redux
- Owner: remorses
- Created: 2019-10-30T13:00:35.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-11-16T19:03:46.000Z (about 6 years ago)
- Last Synced: 2025-03-04T18:40:46.390Z (10 months ago)
- Language: TypeScript
- Homepage:
- Size: 74.2 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README

f-redux
the hooks revolution has just started
## Usage
```
npm i fuck-redux
```
```tsx
import makeHook, { Store } from 'fuck-redux'
const initialState = {
counter: 0,
}
const actions = (store: Store) => ({
addToCounter: (amount) => {
const newCounterValue = store.state.counter + amount
store.setState({ counter: newCounterValue })
},
})
const useSharedState = makeHook(initialState, actions)
const App = () => {
const [globalState, globalActions] = useSharedState()
return (
counter:
{globalState.counter}
globalActions.addToCounter(1)}>
+1 to global
)
}
```