Articles → REACT.JS → Create A List In React.Js

Create A List In React






Example






import React, { Component } from 'react';
import ReactDOM from 'react-dom'
import '../node_modules/bootstrap/dist/css/bootstrap.min.css';


class Message extends Component {

    fruits = ['Banana', 'orange', 'Apple'];
    render() {
        return (
            <div>
                <ul>
                    {this.fruits.map(fruit => <li key={fruit}>{fruit}</li>)}
                </ul>
            </div>
        );
    }

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



Output


Picture showing the list created in react.js
Click to Enlarge


Posted By  -  Karan Gupta
 
Posted On  -  Thursday, August 5, 2021

Query/Feedback


Your Email Id
 
Subject
 
Query/FeedbackCharacters remaining 250