UNPKG

piral-core

Version:

The core library for creating a Piral instance.

12 lines (10 loc) 370 B
import { useContext } from 'react'; import { StateContext } from '../state/stateContext'; import { PiralActions, GlobalStateContext } from '../types'; /** * Hook that gets the actions for manipulating the global state. */ export function useActions() { const { state, ...actions } = useContext<GlobalStateContext>(StateContext); return actions as PiralActions; }