13 lines
317 B
JavaScript
13 lines
317 B
JavaScript
/* eslint-disable import/prefer-default-export */
|
|
import { useContext } from 'react';
|
|
import { StoreContext } from '.';
|
|
|
|
export function useStore() {
|
|
const context = useContext(StoreContext);
|
|
if (context === undefined) {
|
|
throw new Error('useStore must be used within StoreProvider');
|
|
}
|
|
|
|
return context;
|
|
}
|