Add a class like this in react
<body>
</body>
I am expected the code bellow
<body className="dark" >
</body>
You can use a conditional statements to add or append classes like this:
<body className={isDarkState ? "dark" : null}>
</body>
Also, change the class to className as class is a Javascript keyword.
class is a keyword in JavaScript, and JSX is an extension of JavaScript. That's the principal reason why React uses className instead of class. Pass a string as the className prop.
using body as root component is not recommendable. try this approach: https://stackoverflow.com/a/74429568