this.state = { components: [ { id:1, name: 'Some Name' } ] } 

how to display all property value in dom?

    2 answers 2

    CodeSandbox

     import React from "react"; import ReactDOM from "react-dom"; import "./styles.css"; class App extends React.Component { state = { components: [ { id: 1, name: 'Some Name' } ] } render() { return ( <> {this.state.components.map((item, index) => ( <div key={index}>id: {item.id}, name: {item.name}</div> ))} </> ); } } const rootElement = document.getElementById("root"); ReactDOM.render(<App />, rootElement); 

      Array.prototype.map () can be used to render arrays in react.

      You can read about it in detail here, but in English: React lists and keys