Skip to content

Commit

Permalink
[use-effect-hook] Language
Browse files Browse the repository at this point in the history
  • Loading branch information
dgroomes committed Jan 13, 2024
1 parent 33869ba commit 4a95f0b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion use-effect-hook/src/efficient-use-effect/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ export function Main() {
},
// The dependencies array here describes, "Hey React, please re-run this effect when the listener changes."
// Be very careful when you use non-primitive types, like functions and objects, in the dependencies array. Every
// function is different from every other function, even if the function bodies are the result of copy/paste.
// function is different from every other function, even if you feel that the function bodies are "the same" because
// they are the result of copy/paste.
// React uses the "Object.is" method (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is)
// to compare the old and new values of the dependencies array.
[listener])
Expand Down
3 changes: 2 additions & 1 deletion use-effect-hook/src/inefficient-use-effect/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ export function Main() {
},
// The dependencies array here describes, "Hey React, please re-run this effect when the listener changes."
// Be very careful when you use non-primitive types, like functions and objects, in the dependencies array. Every
// function is different from every other function, even if the function bodies are the result of copy/paste.
// function is different from every other function, even if you feel that the function bodies are "the same" because
// they are the result of copy/paste.
// React uses the "Object.is" method (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is)
// to compare the old and new values of the dependencies array.
[listener])
Expand Down
2 changes: 1 addition & 1 deletion use-effect-hook/src/root/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import ReactDOM from 'react-dom/client'
export function Main() {
return (<>
<h1>Learning by Example: React Hooks</h1>
See the <a href="https://github.com/dgroomes/react-playground/tree/main/hooks">README</a> in
See the <a href="https://github.com/dgroomes/react-playground/tree/main/use-effect-hook">README</a> in
the <em>dgroomes/react-playground</em> repository for more information.

<div id="container">
Expand Down

0 comments on commit 4a95f0b

Please sign in to comment.