Skip to content

Instantly share code, notes, and snippets.

@clc80
Last active Jun 4, 2018
Embed
What would you like to do?
With new li to render
import React, { Component } from 'react';
import Form from './components/Form'
import './App.css';
class App extends Component {
constructor(props) {
super(props);
this.state = {
formItems: ['one', 'two', 'three']
}
}
render() {
return (
<div className="App">
<ul>
{this.state.formItems.map( (element, index) =>
<Form
key={index}
formElement={element}
/>
)}
</ul>
</div>
);
}
}
export default App;
import React, { Component } from 'react';
class Form extends Component {
render() {
return(
<div className="Form">
<li> {this.props.formElement} </li>
</div>
);
}
}
export default Form;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment