Reacting to Input With State
https://react.dev/learn/reacting-to-input-with-state
Imperative Programming.
You have to write the exact instructions to manipulate the UI depending on what just happened.
声明式地考虑 UI,预先考虑有哪几种状态,
定义所有可能不同的状态。
考虑状态之间的转换。
Desription:
Make it so that clicking on the picture removes the background–active CSS class from the outer
, but adds the picture–active class to the
. Clicking the background again should restore the original CSS classes.
1 |
|
Note: e.stopPropagation();
Ans Version:
1 |
|
Reacting to Input With State
https://www.hardyhu.cn/2024/12/22/Reacting-to-Input-With-State/