diff --git a/index.html b/index.html
index f19aa5c..5007546 100644
--- a/index.html
+++ b/index.html
@@ -53,8 +53,7 @@
@@ -62,8 +61,7 @@
diff --git a/step1-05/demo/README.md b/step1-05/demo/README.md
index cbbe127..d4e49fa 100644
--- a/step1-05/demo/README.md
+++ b/step1-05/demo/README.md
@@ -1,4 +1,4 @@
-# Building a Static Page
+# Step 1-05: Demo Building a Static Page
To start off our todo application we are going to follow the steps outlined in [Thinking in React](https://reactjs.org/docs/thinking-in-react.html). The first step of the process is to break our application into a component hierarchy. For this app, we're going to keep it simple and just use four parts.
diff --git a/step1-05/exercise/README.md b/step1-05/exercise/README.md
index 4b9bed1..3e7f0c9 100644
--- a/step1-05/exercise/README.md
+++ b/step1-05/exercise/README.md
@@ -1,12 +1,16 @@
-## Exercise
+# Step 1-06 Exercise
### TodoFooter
-1. Add a TodoFooter component, copying over the `` tag and all of its children from `TodoApp.html` in the `step1-05` folder.
+1. Add a TodoFooter component in the `components` folder, copying over the `` tag and all of its children from `TodoApp.html` in the `step1-05` folder. This could be a function or class.
2. Remove any `onclick` properties, and change `class` to `className`
### TodoList
-1. Add a TodoList component like you did with the footer.
+1. Add a TodoList component like you did with the footer. This could also be function or class.
2. Import TodoListItem and add 4 of them inside of the ``
3. Bonus points for using a [`for`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Loops_and_iteration) loop or using [`map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map) to create 4 list items based on the array `[1,2,3,4]`
+
+## App.tsx
+
+1. Import both of these components into `App.tsx` and place their tags below the `TodoHeader`.
diff --git a/step1-05/exercise/src/App.tsx b/step1-05/exercise/src/App.tsx
index 6e797ed..0bd6838 100644
--- a/step1-05/exercise/src/App.tsx
+++ b/step1-05/exercise/src/App.tsx
@@ -1,15 +1,11 @@
import React from 'react';
-import { TodoFooter } from './components/TodoFooter';
import { TodoHeader } from './components/TodoHeader';
-import { TodoList } from './components/TodoList';
export class TodoApp extends React.Component {
render() {
return (
-
-
);
}
diff --git a/step1-05/exercise/src/components/TodoFooter.tsx b/step1-05/exercise/src/components/TodoFooter.tsx
deleted file mode 100644
index 9b089ac..0000000
--- a/step1-05/exercise/src/components/TodoFooter.tsx
+++ /dev/null
@@ -1,9 +0,0 @@
-import React from 'react';
-
-export const TodoFooter = (props: any) => {
- return (
-
- );
-};
diff --git a/step1-05/exercise/src/components/TodoList.tsx b/step1-05/exercise/src/components/TodoList.tsx
deleted file mode 100644
index a26a8e5..0000000
--- a/step1-05/exercise/src/components/TodoList.tsx
+++ /dev/null
@@ -1,7 +0,0 @@
-import React from 'react';
-
-export class TodoList extends React.Component {
- render() {
- return
;
- }
-}
diff --git a/step1-05/final/index.html b/step1-05/final/index.html
deleted file mode 100644
index de2c99d..0000000
--- a/step1-05/final/index.html
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/step1-05/final/src/TodoApp.tsx b/step1-05/final/src/TodoApp.tsx
deleted file mode 100644
index 6e797ed..0000000
--- a/step1-05/final/src/TodoApp.tsx
+++ /dev/null
@@ -1,16 +0,0 @@
-import React from 'react';
-import { TodoFooter } from './components/TodoFooter';
-import { TodoHeader } from './components/TodoHeader';
-import { TodoList } from './components/TodoList';
-
-export class TodoApp extends React.Component {
- render() {
- return (
-
-
-
-
-
- );
- }
-}
diff --git a/step1-05/final/src/components/TodoFooter.tsx b/step1-05/final/src/components/TodoFooter.tsx
deleted file mode 100644
index 9b8abbb..0000000
--- a/step1-05/final/src/components/TodoFooter.tsx
+++ /dev/null
@@ -1,12 +0,0 @@
-import React from 'react';
-
-export const TodoFooter = (props: any) => {
- return (
-
-
- 4 items left
-
- Clear Completed
-
- );
-};
diff --git a/step1-05/final/src/components/TodoHeader.tsx b/step1-05/final/src/components/TodoHeader.tsx
deleted file mode 100644
index a497698..0000000
--- a/step1-05/final/src/components/TodoHeader.tsx
+++ /dev/null
@@ -1,20 +0,0 @@
-import React from 'react';
-
-export class TodoHeader extends React.Component {
- render() {
- return (
-
- );
- }
-}
diff --git a/step1-05/final/src/components/TodoList.tsx b/step1-05/final/src/components/TodoList.tsx
deleted file mode 100644
index 2a89a0f..0000000
--- a/step1-05/final/src/components/TodoList.tsx
+++ /dev/null
@@ -1,15 +0,0 @@
-import React from 'react';
-import { TodoListItem } from './TodoListItem';
-
-export class TodoList extends React.Component {
- render() {
- return (
-
- );
- }
-}
diff --git a/step1-05/final/src/components/TodoListItem.tsx b/step1-05/final/src/components/TodoListItem.tsx
deleted file mode 100644
index 5fe57d1..0000000
--- a/step1-05/final/src/components/TodoListItem.tsx
+++ /dev/null
@@ -1,13 +0,0 @@
-import React from "react";
-
-export class TodoListItem extends React.Component {
- render() {
- return (
-
-
- Todo 1
-
-
- );
- }
-}
diff --git a/step1-05/final/src/index.tsx b/step1-05/final/src/index.tsx
deleted file mode 100644
index ccf63e2..0000000
--- a/step1-05/final/src/index.tsx
+++ /dev/null
@@ -1,4 +0,0 @@
-import React from 'react';
-import ReactDOM from 'react-dom';
-import { TodoApp } from './TodoApp';
-ReactDOM.render( , document.getElementById('app'));
diff --git a/step1-05/final/src/style.css b/step1-05/final/src/style.css
deleted file mode 100644
index 12b482b..0000000
--- a/step1-05/final/src/style.css
+++ /dev/null
@@ -1,49 +0,0 @@
-body {
- font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
- width: 400px;
- margin: 20px auto;
-}
-
-h1 {
- text-align: center;
-}
-
-.addTodo {
- display: flex;
-}
-
-.textfield {
- flex-grow: 1;
- margin-right: 10px;
-}
-
-.submit {
- border: none;
- padding: 5px 10px;
-}
-
-.filter {
- margin: 10px 0 0;
-}
-
-.filter button {
- background: transparent;
- border: none;
-}
-
-.filter .selected {
- border-bottom: 2px solid blue;
-}
-
-.todos {
- list-style: none;
- padding: 0;
-}
-
-footer {
- display: flex;
-}
-
-footer span {
- flex-grow: 1;
-}
diff --git a/step1-06/demo/README.md b/step1-06/demo/README.md
index b7ca915..9adfba5 100644
--- a/step1-06/demo/README.md
+++ b/step1-06/demo/README.md
@@ -1,12 +1,10 @@
-# Creating a State-Driven UI
+# Step 1-06 Demo: Creating a State-Driven UI
In React, the data travels in one direction: top-down in the form of state propagating down the component hierarchy. Only the component containing the state can change the state itself. When a UI interaction occurs, a stateful component must pass down an event handler to the UI component triggering the event in order to signal a state change.
-## Demo
-
[Step #3 of "Thinking in React"](https://reactjs.org/docs/thinking-in-react.html) suggests finding the "minimal set of mutable state" that your application requires. So in this demo we are going to add that "minimal state" to our application and drive our UI off of that data. With that done, the next step will be to create ways to modify that state, which will in turn cascade down through our UI. This [reconciliation](https://reactjs.org/docs/reconciliation.html) process, figuring out what in your UI needs to change based on changing state, is what React excels at.
-### Adding State to App
+## Adding State to `AppTodo.tsx`
Inside our `TodoApp` class, we will add the minimal state for our application, which includes just two keys: `todos` and `filter`. We don't need to worry about a `remaining` value because it can be calculated by counting the number of todos where the `completed` field is set to `false`.
@@ -34,56 +32,51 @@ constructor(props) {
completed: false
}
},
- filter: 'all'
+ filter: 'active'
};
}
```
> You could also use an array to represent your todos. Array manipulation can be easier in some cases, but this object approach simplifies other functionality and will ultimately be more performant.
-### Passing State Through to UI
-
-To avoid reaching into state over and over, we once again use destructuring to pull out the pieces we need.
-
-```jsx
-const { filter, todos } = this.state;
-```
-
-> Note that I've set `todos` to default to an empty array so that the `todos` variable is never undefined
+## Passing State Through to UI
Now we can pass `filter` and `todos` into our components.
```jsx
-return (
-
-
-
-
-
-);
-```
-
-### State-Driven TodoList
-
-I've already pulled out our props into `filter` and `todos` variables, and written a bit of JS that will return an array of filtered todo `id`s. We'll be using that filtered array to render our todo items.
-
-```jsx
-{
- filteredTodos.map(id => );
+render() {
+ const { filter, todos } = this.state;
+ return (
+
+
+
+
+
+ );
}
```
-- [`map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map): This method iterates over the array it's called on, transforming each value with the passed in function and returning the values in a new array (our rendered TodoListItems).
-- `key`: We use the `id` from the `filterTodos` array as the [list item key](https://reactjs.org/docs/lists-and-keys.html) The keys should be unique as they help React track which items are added, removed, or updated and determine whether an instance of an item should be rerendered or a new one created.
-- `id`: The `key` is not actually passed into the component, so we pass the same value as `id` as well. This will help us out later.
-- `todos[id]`: Lastly we use the `id` to grab the todo from our `todos` object, then use the [spread operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax) to pass through the todo's `label` and `completed` values.
- > This spread operator is the same as saying `label={todos[id].label} completed={todos[id].completed}`. Pretty obvious why spread is so handy!
+## State-Driven TodoList
-### State-Driven and Stateful Header
+I've already pulled out our props into `filter` and `todos` variables, and written a bit of JS that will return an array of filtered todo `id`s. We'll be using that filtered array to render our todo items.
+
+> `todos[id]` returns the todo matching the `id` passed in, and the spread operator (...) is the same as saying `label={todos[id].label} completed={todos[id].completed}`
+
+```jsx
+return (
+
+ {filteredTodos.map(id => (
+
+ ))}
+
+);
+```
+
+## State-Driven and Stateful Header
Within the header we've got a situation where we not only want to pass `filter` state down to it, but we also want to maintain state within the control. Fortunately, this is no problem at all for React. First off let's deal with the incoming state.
-#### Conditional Class Names
+### Conditional Class Names
In CSS-based styling, visual states are applied by adding and removing classes. We can use the filter value to conditionally add a class, thereby lighting up the correct filter button.
@@ -97,16 +90,14 @@ In CSS-based styling, visual states are applied by adding and removing classes.
> The [ternary operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Conditional_Operator) `condition ? expressionIfTrue : expressionIfFalse` is widely used in React code, as each expression could be a string for a className or even a JSX element.
-#### Adding a Controlled Input
+### Adding a Controlled Input
-In React, form elements such as ` `, `