0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Hook API(React)[Material-ui]

Posted at

Hook API使う場合は
npm install --save @material-ui/styles
実行してください

import {createStyles, makeStyles} from "@material-ui/core/styles";

const useStyles = makeStyles(() => (
  createStyles({
    "button": {
      borderColor: '#FFB549',
      color: '#FFB549',
      }
    }
  })
));

const Article = (props) => {
  const classes = useStyles();

  return(
    <Button 
      className={classes.button}
      {props.content}
    </Button>
  )

}

const classesからButtomstyleをつけています。

注意
JSON形式でキャメルケースで書くこと
数値は''囲む必要がない

#おまけ(エントリーポイント使い方)
importの記述が多くなるため
エントリーポイント作ってあげたほうが良いです。

index.js
export {default as Hoge} from './Hoge'
export {default as Fuga} from './Fuga'
export {default as Foo} from './Foo'
export {default as Bar} from './Bar'
使いたいところ
import {Hoge, Foo} from './components/index';

export {default as Hoge} from './Hoge'
名前付きエクスポートしているので呼び出すときは{}が入ります

0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?