This version adds a functional component CookieBanner that displays a banner with a message and two buttons, one for accepting cookies and one for declining cookies. It also uses useState and useEffect hooks to manage the state of the site's consent and to register a global event listener as soon as the site loads in the browser. Finally, it checks if ExecutionEnvironment.canUseDOM is true before executing the code, ensuring that the code is only run in the browser environment.
This version adds a functional component CookieBanner that displays a banner with a message and two buttons, one for accepting cookies and one for declining cookies. It also uses useState and useEffect hooks to manage the state of the site's consent and to register a global event listener as soon as the site loads in the browser. Finally, it checks if ExecutionEnvironment.canUseDOM is true before executing the code, ensuring that the code is only run in the browser environment.