import React from 'react'; import ListElement from "./ListElement"; import style from './ListContainer.module.css'; class ListContainer extends React.Component { constructor(props, context) { super(props, context); this.state = { elements: [], title: "Container of Elements" } this.handleclick = this.handleclick.bind(this); } render() { return (
{this.state.title}
{ this.state.elements.map((elemname) => ( )) }
); } handleclick() { let elems = this.state.elements; elems.push("TESTNAME"); this.setState({elements: elems, title: "Container of several Elements"}); } } export default ListContainer;