react-exo-hooks
Version:
A collection of useful hooks for data structures and logic, designed for efficiency
10 lines (9 loc) • 670 B
TypeScript
/**
* Create an object state value that auto updates on mutation \
* This hook is recursive into simple object properties. Class instances will remain unaffected
* @note Effects and memos that use this object should also listen for its signal: `+INSTANCE`
* @warn You should revoke the proxy if you're done with render and don't want unforseen complications. Auto-revokes on and `setObject`
* @param initial The initial object
* @returns [object, setObject, forceUpdate, revoke]
*/
export declare function useObject<T extends object>(initial: T): [object: T, setObject: React.Dispatch<React.SetStateAction<T>>, forceUpdate: () => void, revoke: () => void];