Skip to content

Commit

Permalink
day 22 has been added
Browse files Browse the repository at this point in the history
  • Loading branch information
Asabeneh committed Oct 21, 2020
1 parent 7781cd5 commit 34e4ef9
Show file tree
Hide file tree
Showing 18 changed files with 14,477 additions and 8 deletions.
8 changes: 4 additions & 4 deletions 12_Day_Forms/12_forms.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ Now, you know most of the fields we need to get data from a form. Let's start wi

## Getting data from an input field

So far we did not get any data from input field. Now, it is time to learn how to get data from an input field. We need on input field, event listener (onChange) and state to get data from a controlled input. See the example below. The h1 element below the input tag display what we write on the input. Check live [demo](https://codepen.io/Asabeneh/full/OJVpyqm).
So far we did not get any data from input field. Now, it is time to learn how to get data from an input field. We need an input field, event listener (onChange) and state to get data from a controlled input. See the example below. The h1 element below the input tag display what we write on the input. Check live [demo](https://codepen.io/Asabeneh/full/OJVpyqm).

The input element has many attributes such as value, name, id, placeholder, type and event handler. In addition, we can link a label and an input field using an id of input field and htmlFor of the label.If label and input are linked it will focus the input when we click on label. Look at the example give below.

Expand Down Expand Up @@ -133,7 +133,7 @@ const rootElement = document.getElementById('root')
ReactDOM.render(<App />, rootElement)
```

We usually use form to handle use information. Let us move to form section and make use the form element.
We usually use form to handle user information. Let us move to form section and make use the form element.

## Getting multiple input data from form

Expand Down Expand Up @@ -442,7 +442,7 @@ class App extends React.Component {
type='color'
id='color'
name='color'
value={color}
value={favoriteColor}
onChange={this.handleChange}
placeholder='Favorite Color'
/>
Expand Down Expand Up @@ -930,7 +930,7 @@ ReactDOM.render(<App />, rootElement)
8. What event type do you use to listen changes on an input field?
9. What is the value of a checked checkbox?
10. When do you use onChange, onBlur, onSubmit?
11. What is the purpose of writing e.preventDefault() inside the submit handler method?
11. What is the purpose of writing e.preventDefault() inside the submit handler method?
12. How do you bind data in React? The first input field example is data binding in React.
13. What is validation?
14. What is the event type you use to listen when an input changes?
Expand Down
5 changes: 1 addition & 4 deletions 21_Introducing_Hooks/21_introducing_hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

In the previous, section you have learned how to use React with hooks which is the older version. Currently, hooks has been introduced to React.

Hooks are a new addition in React 16.8. They allow you use state and other React features without writing a class component. If we are using hooks we can have only a functional component in the entire application. For more detail explanation you check [React documentation](https://reactjs.org/docs/hooks-reference.html).
Hooks are a new addition in React 16.8. They allow you use state, life cycle methods and other React features without writing a class component. If we are using hooks we can have only a functional component in the entire application. For more detail explanation you check [React documentation](https://reactjs.org/docs/hooks-reference.html).

Different hooks have been introduced to React:Basic hooks and additional hooks

Expand Down Expand Up @@ -405,6 +405,3 @@ Convert everything you wrote to React hooks.

🎉 CONGRATULATIONS ! 🎉
[<< Day 20](../20_projects/20_projects.md) | [Day 22>>]()



Loading

0 comments on commit 34e4ef9

Please sign in to comment.