UNPKG

@silicon.js/app-state

Version:

A lightweight React Native package for tracking and managing application state changes with a simple provider-based architecture.

12 lines (10 loc) 388 B
import { useContext } from 'react'; import AppStateContext from '../provider/AppStateContext'; import { useAppState } from './useAppState'; export const useAppStateContext = (): ReturnType<typeof useAppState> => { const context = useContext(AppStateContext); if (!context) { throw new Error('useAppStateContext must be used within an AppStateProvider'); } return context; };