回答編集履歴
3
引数が必要か
test
CHANGED
@@ -40,7 +40,9 @@
|
|
40
40
|
|
41
41
|
const stylecolor = "black"
|
42
42
|
|
43
|
-
const ev = false
|
43
|
+
const ev = false //判定用フラグ
|
44
|
+
|
45
|
+
const anycolor = '' //取得した任意のカラー
|
44
46
|
|
45
47
|
const [color,setColor] = useState("")
|
46
48
|
|
@@ -66,7 +68,7 @@
|
|
66
68
|
|
67
69
|
<div
|
68
70
|
|
69
|
-
onClick={handle}
|
71
|
+
onClick={handle(anycolor)}
|
70
72
|
|
71
73
|
style={{background-color: anycolor}}
|
72
74
|
|
2
class ではなくて style
test
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
const hogehoge = "black"
|
8
8
|
|
9
|
-
<div
|
9
|
+
<div style={{background-color: hogehoge}}>
|
10
10
|
|
11
11
|
```
|
12
12
|
|
@@ -20,7 +20,7 @@
|
|
20
20
|
|
21
21
|
const hogehoge = "black"
|
22
22
|
|
23
|
-
<div
|
23
|
+
<div style={
|
24
24
|
|
25
25
|
{background-color: hogehoge}
|
26
26
|
|
1
レイアウトが崩れてた
test
CHANGED
@@ -36,7 +36,7 @@
|
|
36
36
|
|
37
37
|
|
38
38
|
|
39
|
-
``js
|
39
|
+
```js
|
40
40
|
|
41
41
|
const stylecolor = "black"
|
42
42
|
|
@@ -84,7 +84,7 @@
|
|
84
84
|
|
85
85
|
|
86
86
|
|
87
|
-
```
|
87
|
+
```js
|
88
88
|
|
89
89
|
const = style{ "--my-css-var": 10 } as React.CSSProperties;
|
90
90
|
|