React State Update Behavior

🚨 React Interview Question What will be the output? const [count, setCount] = useState(0); const handleClick = () => { setCount(count + 1); setCount(count + 1); }; console.log(count); ❓ After clicking the button once, what will be the value of count? A️ )0 B️ )1 C️ )2 D️ ) Error 👇 Comment your answer below! #ReactJS #FrontendDeveloper #JavaScript #CodingInterview #ReactInterview

To view or add a comment, sign in

Explore content categories