teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

1

回答の趣旨という観点で不要なコードを除去

2019/09/27 07:03

投稿

thyda.eiqau
thyda.eiqau

スコア2982

answer CHANGED
@@ -37,24 +37,13 @@
37
37
  }
38
38
  }
39
39
 
40
-
41
40
  class YourClassName extends React.Component {
42
41
  constructor(props) {
43
42
  super(props);
44
- this.state = {
43
+ this.state = {};
45
- cssstyle: false,
46
- };
47
44
  }
48
-
49
- cssChange= (elm) => {
45
+
50
- elm.classList.toggle('cssstyle');
51
- };
52
-
53
46
  render() {
54
- const cssstyle= ClassNames({
55
- [theme.cssstyle]: this.state.cssstyle,
56
- });
57
-
58
47
  return (
59
48
  <section>
60
49
  <YourDiv classes={['Other', 'Classes']} tetxtContent='ボタン1' />