Understand the dual-cookie (Legacy) mechanism
masterTo handle browsers that do not support the SameSite=None attribute, react-cookie-consent uses two cookies:
- Fallback Cookie: A cookie with a
-legacysuffix is set first. This is designed to succeed on all browsers. - Standard Cookie: The primary cookie is set second. This works on modern browsers but may fail on older ones.
Checking Consent Logic: When the component checks for consent, it performs the check in reverse order:
- It first checks for the regular cookie. If it exists, consent is granted.
- If the regular cookie is missing, it checks for the legacy cookie. If that exists, consent is granted.
- If neither exists, no consent has been given.