• +91 9723535972
  • info@interviewmaterial.com

ReactJS Interview Questions and Answers

Related Subjects

Question - Explain the Lists in React.

Answer -

Lists are used to display data in an ordered format. In React, Lists can be created in a similar way as we create it in JavaScript. We can traverse the elements of the list using the map() function.

Example

import React from 'react';   
import ReactDOM from 'react-dom';   
  
function NameList(props) {  
  const myLists = props.myLists;  
  const listItems = myLists.map((myList) =>  
   
  • {myList}
  •   
      );  
      return (  
       
      
           

    Rendering Lists inside component

      
                 
      {listItems}
      
       
      
      );  
    }  
    const myLists = ['Peter', 'Sachin', 'Kevin', 'Dhoni', 'Alisa'];   
    ReactDOM.render(  
      ,  
      document.getElementById('app')  
    );  

    Comment(S)

    Show all Coment

    Leave a Comment




    NCERT Solutions

     

    Share your email for latest updates

    Name:
    Email:

    Our partners