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:
65
65
66
66
- When creating a variable, each time the component is repainted, the value
67
-
of the variable _myName_ will always be _John Doe_, why? the component
67
+
of the variable _myName_ will always be _John Doe_. Why? the component
68
68
is just function that is executed over and over on each repaint.
69
69
70
-
- If we asign a value directly to the _input_contro, we are skipping to
70
+
- If we asign a value directly to the _input_ we are skipping two
71
71
main pillars of React: unidirection flow and asynchronous state assignment.
72
72
73
-
If you want to see it in action (input not working) you just have to add it to the _app.tsx_ file
73
+
If you want to see it in action (input not working) you just have to add it to the _app.tsx_ file.
74
74
75
75
_./src/app.tsx_
76
76
@@ -84,7 +84,7 @@ export const App = () => {
84
84
};
85
85
```
86
86
87
-
Ok... How can I handle this? Using React hooks! Let's take a look to _React.useState_, this hook:
87
+
Ok... How can I handle this? Using React hooks! Let's take a look to _React.useState_, this hook:
88
88
89
89
- Is initialized with a default value.
90
90
@@ -101,7 +101,7 @@ have a _setName_ or a _setLastname_?
0 commit comments