0.1.0 • Published 1 year ago
@-ft/use-memo-object v0.1.0
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>
);
}
0.1.0
1 year ago