Monday, June 17, 2024

How to render an array of objects in React?

Render an array of objects in React

Hello, welcome to In this post, I will tell you, How to render an array of objects in React?Reactjs is a Javascript Library to build user interface. Now I am also learning Reactjs these day because of my passion to learn new things.

In this post, we will render an array data.  We will use map is used to convert an array with items of type “string” to an array of elements.


Here is working and tested code and I have added this in index.js file:
import React from 'react';
import ReactDOM from 'react-dom';

class Hello extends React.Component{
    //declare custom data array of object
    this.state = {
      names:['ajay', 'alisha', 'jas']
    return (
        //map array data{
            return <li key={name}>{name}</li>

ReactDOM.render(<Hello />, document.getElementById('root'));


if you have any query related to this post then please comment below.

the authortherichpost
Hello to all. Welcome to Myself Ajay Malhotra and I am freelance full stack developer. I love coding. I know WordPress, Core php, Angularjs, Angular 14, Angular 15, Angular 16, Angular 17, Bootstrap 5, Nodejs, Laravel, Codeigniter, Shopify, Squarespace, jQuery, Google Map Api, Vuejs, Reactjs, Big commerce etc.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.