質問編集履歴
2
useStateの型
title
CHANGED
File without changes
|
body
CHANGED
@@ -32,4 +32,12 @@
|
|
32
32
|
|
33
33
|
また、codesandboxでサンプルを作成しエラーが出た型と同じ型を付与したところ、エラーが出ませんでした。
|
34
34
|
|
35
|
-
[サンプル](https://codesandbox.io/s/fast-dew-qo45t?fontsize=14&hidenavigation=1&theme=dark)
|
35
|
+
[サンプル](https://codesandbox.io/s/fast-dew-qo45t?fontsize=14&hidenavigation=1&theme=dark)
|
36
|
+
|
37
|
+
追記 useStateの型
|
38
|
+
---
|
39
|
+
VScode
|
40
|
+

|
41
|
+
|
42
|
+
CodeSandbox
|
43
|
+

|
1
本文
title
CHANGED
File without changes
|
body
CHANGED
@@ -30,6 +30,6 @@
|
|
30
30
|
setStateを子コンポーネントに渡し、子コンポーネントのpropsをtypeで定義した場合、React.Dispatch<React.SetStateAction<boolean>>を設定してもエラーが出ませんでした。
|
31
31
|
ただし親コンポーネントでの型定義は上記の通りエラーが出ます。
|
32
32
|
|
33
|
-
また、codesandboxで
|
33
|
+
また、codesandboxでサンプルを作成しエラーが出た型と同じ型を付与したところ、エラーが出ませんでした。
|
34
34
|
|
35
35
|
[サンプル](https://codesandbox.io/s/fast-dew-qo45t?fontsize=14&hidenavigation=1&theme=dark)
|