dropdown array react code example
Example 1: get selected value on componentdidmount reactjs
let studentData = [
{
"roll":5,
"name":"Sagor",
"student_type":"normal"
},
{
"roll":6,
"name":"Humayun Faridi",
"student_type":"excellent"
}
]
Example 2: get selected value on componentdidmount reactjs
let student = studentData.find(data => data.roll === 5);
console.log(student); //Output: {"roll":5,"name":"Sagor","student_type":"normal"}