@-ft/use-memo-object
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

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>
  );
}

Readme

Keywords

none

Package Sidebar

Install

npm i @-ft/use-memo-object

Weekly Downloads

1

Version

0.1.0

License

MIT

Unpacked Size

1.33 kB

Total Files

4

Last publish

Collaborators

  • mjy9088