Apply style in JSX

To apply style in JSX we need to pass a javaScript object like bellow

 

Example

import React from "react";

export default function App() {
  return (
    <div
      style={{
        width: "80%",
        margin: "auto",
        background: "gray",
        textAlign: "center",
        color: "white",
        padding: "20px",
        fontSize: "25px",
        fontWeight:"800"
      }}
    >
    Apply Style in React JS
    </div>
  );
}

 

About Author

Photo

Hi, I am Mahbub Hasan
Software Engineer

I am very much interested to share my programming
and development knowledge with the people.I will try
to update my blog everyday with new technology inshallah.

Thank You

For Visiting My Blog.

Contact Me