function useStable(getInitialValue) {
  var ref = react.useRef(null);

  if (ref.current == null) {
    ref.current = getInitialValue();
  }

  return ref.current;
}
Hook for integrating the Responder System into React

  function SomeComponent({ onStartShouldSetResponder }) {
    const ref = useRef(null);
    useResponderEvents(ref, { onStartShouldSetResponder });
    return <div ref={ref} />
  }