@-ft/use-memo-object
v0.1.0
Published
React useMemoObject hook
Downloads
4
Readme
use-memo-object - react useMemoObject
hook
memo the context value conveniently
Usage
import { useMemoObject } from '@-ft/use-memo-object';
function AppContextProvider({ children, something }) {
const someValue = useSomeValue();
const value = useMemoObject({ something, someValue });
// instead of...
const v = useMemo(() => ({ something, someValue }), [something, someValue]);
return (
<AppContext.Provider value={value}>
{children}
</AppContext.Provider>
);
}