* First steps of remove react-keydown, replace with hook * RegisterKeyDown component to aid transition away from react-keydown
11 lines
214 B
JavaScript
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;
|
|
}
|