An open API service indexing awesome lists of open source software.

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

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


)
}
```