importReactfrom"react";import"./App.css"classAppextendsReact.Component{constructor(){super();this.state={users:[],newUserName:""}}componentDidMount(){this.setState({users:[{name:"Joe Doe",email:"joe@doe.com"},{name:"Johny Schmoe",email:"johny@schmoe.com"}]})}render(){return(<divclassName="App"><h1>User List</h1><span>//The users bellow are are inserted from an array of objects...</span><br/><span>//as the default state values, using <b>setState</b> */</span><br/><br/><div>{this.state.users.map((user,index)=>{return(<div><span>{index}</span><span>{user.name}</span><br/><span>{user.email}</span><br/><br/></div>)})}</div></div>)}}exportdefaultApp;
Top comments (0)