This repository has been archived on 2022-08-14. You can view files and clone it, but cannot push or open issues or pull requests.
outline/app/hooks/usePrevious.js
Tom Moor 57fa1305a6
chore: Remove react-keydown (#2713)
* First steps of remove react-keydown, replace with hook

* RegisterKeyDown component to aid transition away from react-keydown
2021-11-01 19:52:04 -07:00

11 lines
214 B
JavaScript

// @flow
import * as React from "react";
export default function usePrevious<T>(value: T): T | void {
const ref = React.useRef();
React.useEffect(() => {
ref.current = value;
});
return ref.current;
}