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
The Section on DOM events in the page Using TypeScript, mentions extracting functions, this can be elaborated further to include the case where we do get the types i.e. inline methods.
The section on Pure Functions contain a example of Teacups and guests, the global let guests variable should be incremented by 1, but is incremented by 2. Since, React is running in StrictMode for development, this might be confusing for newbies. Found here: https://react.dev/learn/keeping-components-pure#side-effects-unintended-consequences
Edit: The deep dive for this chapter contains the explanation.
Summary
The Section on DOM events in the page
Using TypeScript
, mentions extracting functions, this can be elaborated further to include the case where we do get the types i.e. inline methods.The section on Pure Functions contain a example of Teacups and guests, the globallet guests
variable should be incremented by 1, but is incremented by 2. Since, React is running in StrictMode for development, this might be confusing for newbies. Found here: https://react.dev/learn/keeping-components-pure#side-effects-unintended-consequencesEdit: The deep dive for this chapter contains the explanation.
Page
https://react.dev/learn/keeping-components-pure
Details
Add another small example where it shows that we do get types when using inline methods, to make it more clear.
Either turn off Strict mode for this example OR explain why we are getting2, 4, 6
instead of the expected1, 2, 3
because of React.StrictMode.The text was updated successfully, but these errors were encountered: