Guest User

Untitled

a guest
Apr 20th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. import Cards from './Components/Cards';
  2. import Forms from './Components/Forms';
  3. import React, { Component } from 'react';
  4. import recipes from './recipes.js'; // mock data
  5. import './App.css';
  6.  
  7. class App extends Component {
  8. constructor(props) {
  9. super(props);
  10. this.state = {
  11. currentName: '',
  12. currentIngredients: '',
  13. currentDirections: [],
  14. recipes: recipes,
  15. updatingCard: false,
  16. };
  17. }
  18.  
  19. submitDelete(e) {
  20. console.log("this is e: ");
  21. // let removedArr = this.state.recipes;
  22. // removedArr.splice(e, 1);
  23. // this.setState({
  24. // recipes: removedArr
  25. // });
  26. }
  27.  
  28. render() {
  29. return (
  30. <div className="App">
  31.  
  32. <header className="App-header">
  33. <h1 className="App-title">Recipe React</h1>
  34. </header>
  35.  
  36. {/* updating a card change input styling and handling function */}
  37. <Forms updating={this.state.updatingCard}/>
  38.  
  39. {/* when updating a card show just that card in the cards section*/}
  40. <Cards
  41. index={0}
  42. updating={this.state.updatingCard}
  43. recipes={this.state.recipes}
  44. handleDelete={this.submitDelete}
  45. />
  46.  
  47. </div>
  48. );
  49. }
  50. }
  51.  
  52. export default App;
Add Comment
Please, Sign In to add comment