Help us understand the problem. What is going on with this article?

[React] makeStyles / createStyles の使い方

makeStyles,
createStyles
をimportし、useStylesを定義

import { makeStyles, createStyles } from '@material-ui/core/styles';   //style関連のimport



const useStyles = makeStyles((theme) => createStyles({  //useStylesを定義
    card: {
        margin: theme.spacing(5),
        padding: theme.spacing(3),
    },
}));

function Home() {

    const classes = useStyles();  //コンポーネント内でuseStylesを使用し、classesを定義

classesをreturnの中のjsxで使用する

    return (
        <div className="container">
            <div className="row justify-content-center">
                <div className="col-md-8">
                    <div className="card">
                        <h1>タスク管理</h1>
                        <Card className={classes.card}>     //return内でstyleを呼び出す



以上、備忘録

ReactではComponentごとにstyleを定義するのが一般的かと思います。

morry_48
LaravelとReactが好きです。
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした