Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor BaseValidateCodeForm.js to functional component #20480

Merged
merged 9 commits into from
Jun 12, 2023
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