Skip to content

Instantly share code, notes, and snippets.

@natafaye
Created April 9, 2022 20:10
Show Gist options
  • Select an option

  • Save natafaye/99d406b8c207fef42bd0462ba96498f9 to your computer and use it in GitHub Desktop.

Select an option

Save natafaye/99d406b8c207fef42bd0462ba96498f9 to your computer and use it in GitHub Desktop.
import { Component } from "react";
import Order from "./ChildComponent";
import { TEST_STUDENTS } from "./shared/student-test-data";
// function App(props) {
// return (
// <div className="App">
// <p className="my-class"></p>
// </div>
// );
// }
class App extends Component {
constructor(props) {
super(props);
this.state = {
dish: "",
addCheese: false
}
}
pickDish = (newDish) => {
this.setState({ dish: newDish })
}
render() {
return (
<div className="App">
Dish:
<button onClick={ () => this.setState({ dish: "burrito" }) }>Burrito</button>
<button onClick={ () => this.pickDish("taco") }>Taco</button>
<p>
<Order dish={this.state.dish} />
</p>
</div>
);
}
}
export default App;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment