JSX | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

JSX

How to write if conditions inside list options if chose this option extend the page if chose another option open new page with click button

29th Jul 2021, 9:01 AM
Bayan
Bayan - avatar
3 Answers
+ 1
You need to learn if else statement first how its working Suppose u create one list like List1=[1,2,3,4,5]; And i used for loop Which will execute from 1 to 5 for (int i=0 .....4) Am using if condition if( List1[2]==3) { Write here code what u want to do } Else { Any other task } This is how if else working u can also do nesting In your case in if condition write any base condition u want that if you have two button and user will click on first button then it should be expand and in else part u can write for other page .
29th Jul 2021, 10:54 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 1
Bayan Here you go, select input with react example https://code.sololearn.com/WW9rAIPLkETy/?ref=app
29th Jul 2021, 12:58 PM
Calviղ
Calviղ - avatar
29th Jul 2021, 1:29 PM
Abhay
Abhay - avatar