Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import Cards from './Components/Cards';
- import Forms from './Components/Forms';
- import React, { Component } from 'react';
- import recipes from './recipes.js'; // mock data
- import './App.css';
- class App extends Component {
- constructor(props) {
- super(props);
- this.state = {
- currentName: '',
- currentIngredients: '',
- currentDirections: [],
- recipes: recipes,
- updatingCard: false,
- };
- }
- submitDelete(e) {
- console.log("this is e: ");
- // let removedArr = this.state.recipes;
- // removedArr.splice(e, 1);
- // this.setState({
- // recipes: removedArr
- // });
- }
- render() {
- return (
- <div className="App">
- <header className="App-header">
- <h1 className="App-title">Recipe React</h1>
- </header>
- {/* updating a card change input styling and handling function */}
- <Forms updating={this.state.updatingCard}/>
- {/* when updating a card show just that card in the cards section*/}
- <Cards
- index={0}
- updating={this.state.updatingCard}
- recipes={this.state.recipes}
- handleDelete={this.submitDelete}
- />
- </div>
- );
- }
- }
- export default App;
Add Comment
Please, Sign In to add comment