Adding Interactivity – React
6
公开标注数
6
参与人数
2026-07-28 09:17:53
首次 Whisper
本页的公开 Whisper
划选高亮2026-07-28 15:41:53
原文高亮摘录
“you shouldn’t change objects and arrays that you hold in the React state directly.”
Whisper 随想笔记
Wait, so I have to copy the whole array just to tweak one item? That feels wasteful but okay.
划选高亮2026-07-28 12:38:53
原文高亮摘录
“Setting it does not change the state variable you already have, but instead triggers a re-render.”
Whisper 随想笔记
So it's like a photo, not a live video? Kinda makes sense but still weird.
划选高亮2026-07-28 12:29:53
原文高亮摘录
“Setting it does not change the state variable you already have, but instead triggers a re-render.”
Whisper 随想笔记
That's why my console.log always shows the old value right after setState, took me a while to get it.
划选高亮2026-07-28 09:35:53
原文高亮摘录
“In React, data that changes over time is called state.”
Whisper 随想笔记
reminds me of variables but with superpowers, nice explanation actually
划选高亮2026-07-28 09:26:53
原文高亮摘录
“In React, data that changes over time is called state.”
Whisper 随想笔记
i always thought state was only for forms, good to know it's broader
划选高亮2026-07-28 09:17:53
原文高亮摘录
“In React, data that changes over time is called state.”
Whisper 随想笔记
so basically state is just a fancy word for stuff that changes lol
分享本页 Whisper
短链接
https://domwhisper.com/s/14ab7e48008b嵌入代码
<iframe src="https://domwhisper.com/embed/14ab7e48008b" width="100%" height="480" style="border:0;border-radius:16px" loading="lazy"></iframe>