Infosys Interview Question

Coding question in react .js