Created
February 7, 2020 20:19
-
-
Save gregoryanderson/30284ac849426af63894cbcf3f86f8c3 to your computer and use it in GitHub Desktop.
Add Idea
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from "react"; | |
import logo from "./logo.svg"; | |
import Form from "./Form"; | |
import Container from './Container' | |
import "./App.css"; | |
class App extends Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
ideas:[ | |
{title: "Make pizza", description: "its deliscious, why not?"}, | |
{title: "Make cake", description: "its yummy, why not?"}, | |
{title: "Make tacos", description: "its tasty, why not?"}, | |
] | |
}; | |
} | |
addIdea = (newIdea) => { | |
this.setState({ideas: [...this.state.ideas, newIdea]}) | |
} | |
render() { | |
return ( | |
<div className="App"> | |
<Form addIdea={this.addIdea}/> | |
<Container ideas={this.state.ideas}/> | |
</div> | |
); | |
} | |
} | |
export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment