From the course: CSS for Developers

Unlock this course with a free trial

Join today to access over 24,800 courses taught by industry experts.

CSS-in-JS

CSS-in-JS

- [Instructor] If you come from a JavaScript background or have worked with JavaScript frameworks, you've probably encountered the concept of CSS in JavaScript or CSS-in-JS. It's exactly what it sounds like, literally writing CSS as part of JavaScript, which means turning a declarative language into an imperative one. As you can imagine, developers have some strong opinions about whether this is a good thing or not. Many CSS-in-JS libraries are framework-agnostic, meaning they can be used with any JavaScript project. That said, individual frameworks like React or Angular may integrate more smoothly with particular libraries. Each of these libraries takes a different approach to how CSS should work when treated as JavaScript and has its own syntax and implementation. Common to all of these approaches is the need for a compiler and build process to convert the CSS-in-JS into actual CSS. These compilers are usually either built into projects at the core or can be added as dependencies…

Contents