Last active
December 4, 2018 01:29
-
-
Save kraigh/515d8b90625a289c7fac1b8f6a713464 to your computer and use it in GitHub Desktop.
Revisions
-
kraigh revised this gist
Dec 4, 2018 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -12,7 +12,8 @@ The next steps are: 1. Make sure you rename any `class` attributes to `className` 2. Add props to your `Todo` component - Will probably need the `id` and `text` at a minimum. - Render those props instead of having them hardcoded (to test, pass them when you create the component, i.e. `<Todo id="123" text="test" />` - Display the props inside the component, in `Todo.js`, i.e. `<p>{this.props.text}</p>` 3. Add your AJAX GET call - Add a `constructor()` method to your `App` component and initialize `this.state` there with an empty `todos` array. - Make sure to call `super()` at the start of your constructor! -
kraigh revised this gist
Nov 20, 2018 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,11 +1,13 @@ # Steps to complete to turn Todo app into React After following the instructions [here](https://gist.github.com/kraigh/b3258935d243c718577b0b38c8450da8), you should have the following: - Working react app - Ability to deploy react app to Github Pages - `App` component that does initial setup and composes your other components - `NewTodo` component containing the form for a new Todo - `Todo` component containing HTML for a single Todo - CSS files for each component The next steps are: 1. Make sure you rename any `class` attributes to `className` 2. Add props to your `Todo` component -
kraigh revised this gist
Nov 20, 2018 . 1 changed file with 15 additions and 15 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -12,21 +12,21 @@ The next steps are: - Will probably need the `id` and `text` at a minimum. - Render those props instead of having them hardcoded (to test, pass them when you create the component, i.e. <Todo id="123" text="test" /> 3. Add your AJAX GET call - Add a `constructor()` method to your `App` component and initialize `this.state` there with an empty `todos` array. - Make sure to call `super()` at the start of your constructor! - Use a `componentDidMount()` method in your `App` component and put your AJAX javascript there. - After the AJAX call is complete and successful, update `this.state.todos` with your new Todo items. 4. Render `Todo` component for each Todo item. - Use `.map` and the syntax from the slides to loop through your todos and render a new `<Todo>` for each of them. - Make sure to pass a `key` attribute 5. Add event methods for completing and deleting a ToDo - Attach them to the buttons using an `onClick` prop. - Add your AJAX for completing and deleting inside those methods - Be sure to add the `bind` call from the slides. - Update `this.state` if necessary 6. Add event method for submitting new Todo form. - Attach to your form using an `onSubmit` prop. - Add your AJAX for adding new Todos inside the event method - Be sure to add the `bind` call from the slides - Don't forget `event.preventDefault()` - Update `state` with your new Todo. -
kraigh revised this gist
Nov 20, 2018 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -9,8 +9,8 @@ After following the instructions (here)[https://gist.github.com/kraigh/b3258935d The next steps are: 1. Make sure you rename any `class` attributes to `className` 2. Add props to your `Todo` component - Will probably need the `id` and `text` at a minimum. - Render those props instead of having them hardcoded (to test, pass them when you create the component, i.e. <Todo id="123" text="test" /> 3. Add your AJAX GET call - Add a `constructor()` method to your `App` component and initialize `this.state` there with an empty `todos` array. - Make sure to call `super()` at the start of your constructor! -
kraigh created this gist
Nov 20, 2018 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,32 @@ # Steps to complete to turn Todo app into React After following the instructions (here)[https://gist.github.com/kraigh/b3258935d243c718577b0b38c8450da8], you should have the following: - Working react app - Ability to deploy react app to Github Pages - `App` component that does initial setup and composes your other components - `NewTodo` component containing the form for a new Todo - `Todo` component containing HTML for a single Todo - CSS files for each component The next steps are: 1. Make sure you rename any `class` attributes to `className` 2. Add props to your `Todo` component - Will probably need the `id` and `text` at a minimum. - Render those props instead of having them hardcoded (to test, pass them when you create the component, i.e. <Todo id="123" text="test" /> 3. Add your AJAX GET call - Add a `constructor()` method to your `App` component and initialize `this.state` there with an empty `todos` array. - Make sure to call `super()` at the start of your constructor! - Use a `componentDidMount()` method in your `App` component and put your AJAX javascript there. - After the AJAX call is complete and successful, update `this.state.todos` with your new Todo items. 4. Render `Todo` component for each Todo item. - Use `.map` and the syntax from the slides to loop through your todos and render a new `<Todo>` for each of them. - Make sure to pass a `key` attribute 5. Add event methods for completing and deleting a ToDo - Attach them to the buttons using an `onClick` prop. - Add your AJAX for completing and deleting inside those methods - Be sure to add the `bind` call from the slides. - Update `this.state` if necessary 6. Add event method for submitting new Todo form. - Attach to your form using an `onSubmit` prop. - Add your AJAX for adding new Todos inside the event method - Be sure to add the `bind` call from the slides - Don't forget `event.preventDefault()` - Update `state` with your new Todo.