Skip to content

Instantly share code, notes, and snippets.

@clc80
Last active June 4, 2018 23:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clc80/b213130759062dfb4bfea8e9b781721e to your computer and use it in GitHub Desktop.
Save clc80/b213130759062dfb4bfea8e9b781721e to your computer and use it in GitHub Desktop.
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