function RefreshableLabel({ children, value, className }) {
  // used for outputting 'changed' css class
  const [hasDataChanged, setHasDataChanged] = useState(false);
  // used for storing previous value and so be able to compare with new value
  const prevValue = usePrevious(value);

  let labelClassName = className;
  if (hasDataChanged) labelClassName += ' changed';

  useEffect(() => {
    const sToMs = 1000;
    const compareData = () => {
      if (prevValue && value !== prevValue) {
        setHasDataChanged(true);
      }

      return setTimeout(
        () => setHasDataChanged(false),
        animationDuration * sToMs
      );
    };

    const timer = compareData();

    return () => clearTimeout(timer);
  }, [prevValue, value]);

  return <Wrapper className={labelClassName}>{children}</Wrapper>;
}
/**
 * RefreshableLabel is an inline-block HTML container
 * that is used to temporarily highlight its content.
 *
 * It is typically used to indicate that its content
 * has changed. To detect a change, it provides a property
 *
 *   value (String or Number)
 *
 * which is a string or a number. When this
 * value changes, visual highlighting is triggered.
 */
RefreshableLabel is an inline-block HTML container
that is used to temporarily highlight its content.

It is typically used to indicate that its content
has changed. To detect a change, it provides a property

value (String or Number)

which is a string or a number. When this
value changes, visual highlighting is triggered.
RefreshableLabel is an inline - block HTML container that is used to temporarily highlight its content . It is typically used to indicate that its content has changed . To detect a change it provides a property value ( String or Number ) which is a string or a number . When this value changes visual highlighting is triggered .
function RefreshableLabel({ children, value, className }) {
  const [hasDataChanged, setHasDataChanged] = useState(false);
  const prevValue = usePrevious(value);
  let labelClassName = className;
  if (hasDataChanged) labelClassName += ' changed';
  useEffect(() => {
    const sToMs = 1000;
    const compareData = () => {
      if (prevValue && value !== prevValue) {
        setHasDataChanged(true);
      }
      return setTimeout(
        () => setHasDataChanged(false),
        animationDuration * sToMs
      );
    };
    const timer = compareData();
    return () => clearTimeout(timer);
  }, [prevValue, value]);
  return <Wrapper className={labelClassName}>{children}</Wrapper>;
}
function RefreshableLabel ( { children , value , className } ) { const [ hasDataChanged , setHasDataChanged ] = useState ( false ) ; const prevValue = usePrevious ( value ) ; let labelClassName = className ; if ( hasDataChanged ) labelClassName += ' changed' ; useEffect ( ( ) => { const sToMs = 1000 ; const compareData = ( ) => { if ( prevValue && value !== prevValue ) { setHasDataChanged ( true ) ; } return setTimeout ( ( ) => setHasDataChanged ( false ) , animationDuration * sToMs ) ; } ; const timer = compareData ( ) ; return ( ) => clearTimeout ( timer ) ; } , [ prevValue , value ] ) ; return < Wrapper className = { labelClassName } > { children } < / Wrapper > ; }
RefreshableLabel is an inline-block HTML container
 that is used to temporarily highlight its content.
RefreshableLabel is an inline - block HTML container that is used to temporarily highlight its content .
// used for outputting 'changed' css class // used for storing previous value and so be able to compare with new value