Q10_131_20250728073059.webp
white_cloud1

Q10_131_20250728073059.webp

ple Choices
☑Kizspy.me
☐ A
☐ B
ос
☐ D
(Choose 1
answer)
How can you avoid contradictions in state with this code?
const [isOpen, setls Open] = useState(false);
const [buttonText, setButtonText] = useState(is Open ? "se": "Open");
function toggle() {
setls Open (lisOpen);
setButtonText(is Open ? "Open": "se");
A. The code above is fine as it is.
B. Remove buttonText from state and calculate it dynamically in the render method based on is Open.
C. Keep both is Open and button Text in state but update them separately.
D. Use useEffect to sync button Text with is Open.
I want to in the exam.
LAPTOP RUNNING

Thông tin

Category
FER202
Thêm bởi
white_cloud1
Ngày thêm
Lượt xem
3,191
Lượt bình luận
9
Rating
0.00 star(s) 0 đánh giá

Share this media

Back
Bên trên Bottom