How to style body in StyleX?

115 Views Asked by At

In StyleX, how to style a body?

The body element that stays outside any React component, is usually styled using useEffect, but I can't figure out how to actually use that in StyleX.

There's nothing in the [documentation] about it (searched for "body" keyword).

1

There are 1 best solutions below

0
Naman Goel On

If the body element is not rendered by a component (which is the case with Next.js), then use a traditional CSS file to style it.

StyleX is made for styling components and keep those styles contained. You’re supposed to keep using traditional CSS for global styles and resets.