Miloš Milutinov
Miloš Milutinov

Reputation: 417

How do I edit or import CSS in React?

I'm new to React and I seem to have a problem with CSS loading. I tried to import it according to the tutorial, but that doesn't seem to be a good way to do it now, because the tutorial is a bit older. Here's my code, I hope someone can help.

Why isn't my CSS loading? What should I do?

Layout.js:

import React from "react";
import Aux from "../../hoc/Auxx";
import classes from './Layout.css'

const layout = (props) => (
  <Aux>
    <div>Toolbar, SideDrawer, Backdrop</div>
    <main className={classes.Content}>{props.children}</main>
  </Aux>
);

export default layout;

Layout.css

.Content{
    margin-top: 60px;
}

Upvotes: 0

Views: 74

Answers (1)

AL.Sharie
AL.Sharie

Reputation: 1615

just import it normally

import './Layout.css'

and use the classes like you do in a normal css

const layout = (props) => (
  <Aux>
    <div>Toolbar, SideDrawer, Backdrop</div>
    <main className={"Content"}>{props.children}</main>
  </Aux>
);

Upvotes: 1

Related Questions