Skip to content

Commit 6ba6502

Browse files
committed
total の遅延処理を削除
1 parent f078fe7 commit 6ba6502

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

src/App.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,7 @@ const AddButton = ({ disabled, onClick }) => {
6666
const Total = ({ cartItems }) => {
6767
console.log('renders <Total />');
6868

69-
const total = cartItems.reduce((acc, cur) => {
70-
const t = Date.now();
71-
72-
while (Date.now() - t < 100) {
73-
// 擬似的に100ミリ秒の遅延を発生させる
74-
}
75-
76-
return cur.length * 100 + acc;
77-
}, 0);
69+
const total = cartItems.reduce((acc, cur) => cur.length * 100 + acc, 0);
7870

7971
return <p>合計: {total}</p>;
8072
};

0 commit comments

Comments
 (0)