React - how to style with embedded <style> element

2 points
Created by:

In this article, we would like to show you how to style with embedded <style> element in React.

Below example presents the use of template literals (``) wrapped with curly braces ({}) inside <style> tag to create the style for our <div> element.

Practical example:

// ONLINE-RUNNER:browser;

// Note: Uncomment import lines during working with JSX Compiler.
// import React from 'react';
// import ReactDOM from 'react-dom';

const App = () => {
  return (
      My div
        div {
          background: lightblue;
          border: solid;
          border-color: blue;

const root = document.querySelector('#root');
ReactDOM.render(<App />, root);


React - how to style with embedded <style> element
Native Advertising
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂