started by writing a simple function to be attached to the Next button and as I went through iterations of it i added States and most importantly figured that I can use State to manage the index number of the questions array as currentQuestionNumber, given that for the moment we will advance to the next question by just adding +1 to the index.
this replaces all the hardcoded [0] i had placed in App and because of that FlagComponent will also dynamically re-render when we click on Next
started by writing a simple function to be attached to the Next button and as I went through iterations of it i added States and most importantly figured that I can use State to manage the index number of the questions array as
currentQuestionNumber
, given that for the moment we will advance to the next question by just adding+1
to the index. this replaces all the hardcoded[0]
i had placed in App and because of thatFlagComponent
will also dynamically re-render when we click on Next