Import css
- Index.css
- import “./index.css”;
Â
Index.css
- Color is green in body
- When you want to use myClassÂ
- you have to use in this way, it will be className instead of class
- <li className=”myClass”>React</li>Â
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
color: green;
}
code {
font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", monospace;
}
.myClass {
color: blue;
}
Index.js
import React from "react";
import ReactDOM from "react-dom/client";
import "./index.css";
import App from "./App";
const root = ReactDOM.createRoot(document.getElementById("root"));
root.render(
);
App.js
import React from "react";
const App = () => {
const myStyle = {
color: "black",
fontSize: "2.5rem",
};
return (
<>
- React -(inline style)
- Angular -(className)
- Vue -(inline style object)
- xyz
>
);
};
export default App;
Keeping Image tips
- Images when kept in public folder is less performant
- Keeping images in src folder is good as they get optimized
Â