質問編集履歴
2
変更
title
CHANGED
File without changes
|
body
CHANGED
@@ -36,4 +36,19 @@
|
|
36
36
|
setIsSorting(true);
|
37
37
|
resolve();
|
38
38
|
});
|
39
|
+
```
|
40
|
+
|
41
|
+
##試したこと
|
42
|
+
コールバック関数がコンソールログ等の場合はそのまま書けば良いと思うのですが、resolveの場合はどのようにすれば良いのでしょうか。
|
43
|
+
[https://www.aizulab.com/blog/react-usestate-callback/](https://www.aizulab.com/blog/react-usestate-callback/)
|
44
|
+
|
45
|
+
```javascript
|
46
|
+
useEffect(() => {
|
47
|
+
//??
|
48
|
+
}, [sortingItemKey, isSorting]);
|
49
|
+
|
50
|
+
return new Promise((resolve) => {
|
51
|
+
setSortingItemKey(items[index]);
|
52
|
+
setIsSorting(true);
|
53
|
+
});
|
39
54
|
```
|
1
記載ミス
title
CHANGED
File without changes
|
body
CHANGED
@@ -12,7 +12,7 @@
|
|
12
12
|
### 該当のソースコード
|
13
13
|
|
14
14
|
```ここに言語名を入力
|
15
|
-
const [
|
15
|
+
const [sortingItemKey, setSortingItemKey] = React.useState(null);
|
16
16
|
const [isSorting, setIsSorting] = React.useState(false);
|
17
17
|
|
18
18
|
//省略
|