Files
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;
}