Hex Core JS
    Preparing search index...

    Function useMemoArray

    • Returns a memoized array containing the given elements. Useful for passing an array to children that is created in the parent component (but the array itself is not held in state) so that the identity of the array is stable as long as the values in the array are unchanged.

      Type Parameters

      • T

      Parameters

      • ...elements: T[]

        The elements with which to populate the resulting array.

      Returns T[]

      function Component() {
      const [a, setA] = React.useState(0);
      const [b, setB] = React.useState(0);

      return (
      <Child aAndB={useMemoArray(a, b)}/>
      )
      }