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

質問編集履歴

2

useStateの型

2020/01/18 04:21

投稿

MajinBoo
MajinBoo

スコア16

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
+ ![a](7c3ac6c8ce13181b790b3ff6e73ae1b9.jpeg)
41
+
42
+ CodeSandbox
43
+ ![イメージ説明](c0cebe7051a2aeccba6623c8d833ccb4.jpeg)

1

本文

2020/01/18 04:21

投稿

MajinBoo
MajinBoo

スコア16

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)