valtio
Version:
🧙 Valtio makes proxy-state simple for React and Vanilla
25 lines (24 loc) • 798 B
text/typescript
type Config = Parameters<(Window extends {
__REDUX_DEVTOOLS_EXTENSION__?: infer T;
} ? T : {
connect: (param: any) => any;
})['connect']>[0];
type Options = {
enabled?: boolean;
name?: string;
} & Config;
/**
* Connects a proxy object to Redux DevTools Extension for state debugging
*
* This allows real-time monitoring and time-travel debugging of state changes
* using the Redux DevTools browser extension.
*
* Limitation: Only plain objects/values are supported.
*
* @example
* import { devtools } from 'valtio/utils'
* const state = proxy({ count: 0, text: 'hello' })
* const unsub = devtools(state, { name: 'state name', enabled: true })
*/
export declare function devtools<T extends object>(proxyObject: T, options?: Options): (() => void) | undefined;
export {};