Skip to content

Instantly share code, notes, and snippets.

@simbathesailor
Last active December 25, 2019 11:33
Show Gist options
  • Save simbathesailor/a7d2fe631528853dc218cfd2e51e81cc to your computer and use it in GitHub Desktop.
Save simbathesailor/a7d2fe631528853dc218cfd2e51e81cc to your computer and use it in GitHub Desktop.
blog6.md
function useRefValues(value) {
  const ref = React.useRef(value);
  React.useEffect(() => {
    ref.current = value;
  });
  return [ref];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment