BIG-126: async localization loaded data failed to be injected to application.

This commit is contained in:
a.bouhuolia
2021-10-06 17:47:52 +02:00
parent 862a667ef6
commit 369734ab18
14 changed files with 192 additions and 136 deletions

View File

@@ -0,0 +1,15 @@
import { useRef, useEffect } from 'react';
// Hook
export function usePrevious(value) {
// The ref object is a generic container whose current property is mutable ...
// ... and can hold any value, similar to an instance property on a class
const ref = useRef();
// Store current value in ref
useEffect(() => {
ref.current = value;
}, [value]); // Only re-run if value changes
// Return previous value (happens before update in useEffect above)
return ref.current;
}