12 lines
267 B
JavaScript
12 lines
267 B
JavaScript
import { StoreContext } from '.';
|
|
import { useContext } from 'react';
|
|
|
|
export function useStore() {
|
|
const context = useContext(StoreContext);
|
|
if (context === undefined) {
|
|
throw new Error('useStore must be used within StoreProvider');
|
|
}
|
|
|
|
return context;
|
|
}
|