get selected value on componentdidmount reactjs code example
Example 1: 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"}
Example 2: get selected value on componentdidmount reactjs
let studentData = [
{
"roll":5,
"name":"Sagor",
"student_type":"normal"
},
{
"roll":6,
"name":"Humayun Faridi",
"student_type":"excellent"
}
]