Question from the React ⚛️ test

Write a React component that displays the number 2

Hard

What will this component display?

const MyComponent=()=>{
    const[index, setIndex]= useState(1);
    setIndex(2);
    return<div>{index}</div>;
}
Author: Jérémy BeuchotStatus: Published(Update)Question passed 3 times
Edit
0
Community EvaluationsNo one has reviewed this question yet, be the first!