import { useEffect, useState } from 'react';
import { isBlackFridayPeriod } from 'proton-shared/lib/helpers/blackfriday';

const EVERY_TEN_MINUTES = 10 * 60 * 1000;

const useBlackFriday = () => {
    const [blackFriday, setBlackFriday] = useState(isBlackFridayPeriod());

    useEffect(() => {
        const intervalID = setInterval(() => {
            setBlackFriday(isBlackFridayPeriod());
        }, EVERY_TEN_MINUTES);

        return () => {
            clearInterval(intervalID);
        };
    }, []);

    return blackFriday;
};

export default useBlackFriday;

import { useEffect, useState } from 'react';
import { isBlackFridayPeriod } from 'proton-shared/lib/helpers/blackfriday';

const EVERY_MINUTE = 60 * 1000;

const useBlackFriday = () => {
    const [blackFriday, setBlackFriday] = useState(isBlackFridayPeriod());

    useEffect(() => {
        const intervalID = setInterval(() => {
            setBlackFriday(isBlackFridayPeriod());
        }, EVERY_MINUTE);

        return () => {
            clearInterval(intervalID);
        };
    }, []);

    return blackFriday;
};

export default useBlackFriday;

Check BF condition every minute
Check BF condition every minute
