To check whether the cookie exists or not, you can use console.log
and check the value returned by Cookies.get(cookieName)
. If the cookie exists, it will return the value of the cookie, which in this case is the string "inStoClosed". If the cookie does not exist, it will return undefined
.
useEffect(() => {
console.log('Cookie value:', Cookies.get(cookieName)); // add this line
const fetchFeaturedSTO = async () => {
// rest of the code
};
// rest of the code
}, [state, area, cookieName]);
This will log the value of the cookie to the console every time the useEffect
function is called. You can then open your browser's developer console and check whether the cookie value is logged or not.