Skip to content

Commit

Permalink
Merge pull request #20480 from Expensify/andrewli-refactor-basevalida…
Browse files Browse the repository at this point in the history
…tecodeform

Refactor BaseValidateCodeForm.js to functional component
  • Loading branch information
AndrewGable authored Jun 12, 2023
2 parents 28ad1da + b642637 commit 96fcede
Show file tree
Hide file tree
Showing 2 changed files with 178 additions and 158 deletions.
15 changes: 15 additions & 0 deletions src/hooks/usePrevious.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import {useEffect, useRef} from 'react';

/**
* A hook that returns the previous value of a variable
*
* @param {*} value
* @returns {*}
*/
export default function usePrevious(value) {
const ref = useRef();
useEffect(() => {
ref.current = value;
}, [value]);
return ref.current;
}
Loading

0 comments on commit 96fcede

Please sign in to comment.