It works similarly to useCallback hook. In this example, useMemo takes a function that returns our CustomInput component and that function is called only on first render, ComponentDidMount lifecycle method. So every time the map is re-rendered it takes old component. Use memo is used for optimizations, it is very useful even though it is not as used as useState and useEffect hooks.
Until next time, happy coding.