@sampettersson/constate
Version:
Yet another React state management library that lets you work with local state and scale up to global state with ease
20 lines (16 loc) • 460 B
text/typescript
import * as React from "react";
import { StateUpdater, StateCallback, MountContainer } from "./types";
export interface ContextState {
state: {
[key: string]: any;
};
setContextState?: <S, K>(
context: string,
updaterOrState: StateUpdater<S> | Partial<S>,
callback?: StateCallback,
type?: K
) => void;
mountContainer?: MountContainer;
}
const Context = React.createContext<ContextState>({ state: {} });
export default Context;