- 
                Notifications
    You must be signed in to change notification settings 
- Fork 0
useActions
        Александр edited this page Jan 17, 2023 
        ·
        1 revision
      
    export function useActions<T>(actions: T): TAccepts a redux actions
Returns wrapped actions. They can be used without dispatcher.
import { afc, useActions } from 'react-afc'
import { actions } from './store'
function Component(props) {
  const { changeCount } = useActions(actions)
  function setCountToFive() {
    changeCount(5)
  }
  return () => (
    <button onClick={setCountToFive}>
      Change count
    </button>
  )
}
export default afc(Component)Component
Lifecycle
State
Redux
Other