Я просто не понимаю, что это и зачем.
Вместо useDispatch?
Чтобы вместо
export const Counter = () => {
const count = useSelector(counterSelectors.count)
const dispatch = useDispatch()
const increment = () => dispatch(counterActions.increment())
const decrement = () => dispatch(counterActions.decrement())
const reset = () => dispatch(counterActions.reset())
return (
<div>
<p>Count: {count}</p>
<div>
<button onClick={increment}>Increment</button>
<button onClick={decrement}>Decrement</button>
<button onClick={reset}>Reset</button>
</div>
</div>
)
}
делать
export const Counter = () => {
const count = useSelector(counterSelectors.count)
const { increment, decrement, reset } = useActions(counterActions)
return (
<div>
<p>Count: {count}</p>
<div>
<button onClick={increment}>Increment</button>
<button onClick={decrement}>Decrement</button>
<button onClick={reset}>Reset</button>
</div>
</div>
)
}