You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you come to a React project and you come across code like this, it's a bad smell, looks like the person that have coded it did not take the time to learn the basics of this library, let's see why:
74
74
75
75
- When creating a variable, each time the component is repainted, the value
76
-
of the variable _myName_ will always be _John Doe_, why? the component
76
+
of the variable _myName_ will always be _John Doe_. Why? the component
77
77
is just function that is executed over and over on each repaint.
78
78
79
-
- If we asign a value directly to the _input_contro, we are skipping to
79
+
- If we asign a value directly to the _input_ we are skipping two
80
80
main pillars of React: unidirection flow and asynchronous state assignment.
81
81
82
-
If you want to see it in action (input not working) you just have to add it to the _app.tsx_ file
82
+
If you want to see it in action (input not working) you just have to add it to the _app.tsx_ file.
83
83
84
84
_./src/app.tsx_
85
85
@@ -93,7 +93,7 @@ export const App = () => {
93
93
};
94
94
```
95
95
96
-
Ok... How can I handle this? Using React hooks! Let's take a look to _React.useState_, this hook:
96
+
Ok... How can I handle this? Using React hooks! Let's take a look to _React.useState_, this hook:
97
97
98
98
- Is initialized with a default value.
99
99
@@ -110,7 +110,7 @@ have a _setName_ or a _setLastname_?
Copy file name to clipboardExpand all lines: Readme.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,15 +17,15 @@ Set of step by step guide examples covering React Hooks, from start to advanced
17
17
18
18
About this examples:
19
19
20
-
- Each example is focused in a topic (simple and straightforward).
21
-
- Each example contains a Readme.md with an step by step guide to reproduce it.
20
+
- Each example is focused on a topic (simple and straightforward).
21
+
- Each example contains a Readme.md with a step by step guide to reproduce it.
22
22
23
23
# Examples implemented
24
24
25
25
List of examples:
26
26
27
27
-[00-boiler-plate](https://github.com/Lemoncode/react-hooks-by-example/tree/master/00-boilerplate): starting point, just a blank create-react-app project (all examples will take
28
-
this as starting point)
28
+
this as starting point).
29
29
-[01-use-state](https://github.com/Lemoncode/react-hooks-by-example/tree/master/01-use-state): adding state (simple element) to a functional component.
30
30
-[02-use-state-object](https://github.com/Lemoncode/react-hooks-by-example/tree/master/02-use-state-object): adding state (object) to a functional component.
31
31
-[03-component-did-mount](https://github.com/Lemoncode/react-hooks-by-example/tree/master/03-component-did-onload): executing some operations when a functional component gets mounted.
0 commit comments