Switch to use() for context
This commit is contained in:
parent
ce9e384375
commit
2411b2a2b6
@ -2,7 +2,7 @@ import {
|
||||
Dispatch,
|
||||
SetStateAction,
|
||||
createContext,
|
||||
useContext,
|
||||
use,
|
||||
RefObject,
|
||||
} from 'react';
|
||||
import { AnimationConfig } from '@/components/AnimateItems';
|
||||
@ -12,7 +12,8 @@ import { INITIAL_UPLOAD_STATE, UploadState } from '@/admin/upload';
|
||||
import { AdminData } from '@/admin/actions';
|
||||
import { RecipeProps } from '@/recipe';
|
||||
import { getCountsForCategoriesCachedAction } from '@/category/actions';
|
||||
export type AppStateContext = {
|
||||
|
||||
export type AppStateContextType = {
|
||||
// CORE
|
||||
previousPathname?: string
|
||||
hasLoaded?: boolean
|
||||
@ -73,8 +74,8 @@ export type AppStateContext = {
|
||||
setShouldDebugRecipeOverlays?: Dispatch<SetStateAction<boolean>>
|
||||
} & Partial<AdminData>
|
||||
|
||||
export const AppStateContext = createContext<AppStateContext>({
|
||||
export const AppStateContext = createContext<AppStateContextType>({
|
||||
uploadState: INITIAL_UPLOAD_STATE,
|
||||
});
|
||||
|
||||
export const useAppState = () => useContext(AppStateContext);
|
||||
export const useAppState = () => use(AppStateContext);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user