How to use the memoize-one/dist/memoize-one.cjs.js function in memoize-one

To help you get started, we’ve selected a few memoize-one examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github material-components / material-components-web-react / packages / list / index.tsx View on Github external
private getListProps = (checkboxList?: boolean, radioList?: boolean) => ({
    checkboxList: Boolean(checkboxList),
    radioList: Boolean(radioList),
    handleKeyDown: this.handleKeyDown,
    handleClick: this.handleClick,
    handleFocus: this.handleFocus,
    handleBlur: this.handleBlur,
    onDestroy: this.onDestroy,
    getClassNamesFromList: this.getListItemClassNames,
    getListItemInitialTabIndex: this.getListItemInitialTabIndex,
  });

  // decreases rerenders
  // https://overreacted.io/writing-resilient-components/#dont-stop-the-data-flow-in-rendering
  getListPropsMemoized = memoizeOne(this.getListProps);

  render() {
    const {
      /* eslint-disable @typescript-eslint/no-unused-vars */
      className,
      checkboxList,
      radioList,
      nonInteractive,
      dense,
      avatarList,
      twoLine,
      singleSelection,
      role,
      selectedIndex,
      handleSelect,
      wrapFocus,

memoize-one

A memoization library which only remembers the latest invocation

MIT
Latest version published 3 years ago

Package Health Score

73 / 100
Full package analysis