UNPKG

@restate/core

Version:

_Restate_ is a predictable, easy to use, easy to integrate, typesafe state container for [React](https://reactjs.org/).

28 lines 1.19 kB
import React from 'react'; import { CreateStoreProps } from './create-store'; /** * * @example * export const { StateProvider, useAppState, useNext} = create({ * state: { * user: { * name: "John", * age: 32 * } * } * }) */ export declare function create<STATE extends object, TRACE = any>({ state, middleware, options }: CreateStoreProps<STATE, TRACE>): { AppStateContext: import("./create-provider").RxStoreContext<STATE>; StateProvider: (props: { children: React.ReactNode; }) => JSX.Element; useAppState: <SUB_SUB_STATE>(selector: (state: STATE) => SUB_SUB_STATE, options?: { trace?: unknown; } | undefined) => [value: SUB_SUB_STATE, next: (s: SUB_SUB_STATE | ((x: SUB_SUB_STATE) => void | SUB_SUB_STATE)) => void]; useSelector: import("./create-selector-hook").UseSelectorHook<STATE>; useNext: <T, TRACE_1 = any>(selector: (state: STATE) => T, trace?: TRACE_1 | undefined) => (updateFunction: T | ((state: T) => void)) => void | T; store: import("./rx-store").RestateStore<STATE, string>; useStore: () => import("./rx-store").RestateStore<STATE, any>; }; //# sourceMappingURL=create.d.ts.map