mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-16 14:52:31 +00:00
21 lines
538 B
TypeScript
21 lines
538 B
TypeScript
import { createContext, Dispatch, ReactNode, useReducer } from "react";
|
|
import {
|
|
AppUiState,
|
|
AppUiAction,
|
|
appUiReducer,
|
|
appUiInitialStateValues,
|
|
} from "../reducers";
|
|
|
|
export const AppUiContext = createContext<[AppUiState, Dispatch<AppUiAction>]>([
|
|
appUiInitialStateValues,
|
|
() => {},
|
|
]);
|
|
|
|
export const AppUIProvider = ({ children }: { children: ReactNode }) => {
|
|
const value = useReducer(appUiReducer, appUiInitialStateValues);
|
|
|
|
return (
|
|
<AppUiContext.Provider value={value}>{children}</AppUiContext.Provider>
|
|
);
|
|
};
|