Add deps to useEffect
This commit is contained in:
parent
447de944e4
commit
a652d427eb
4
react.md
4
react.md
|
@ -365,7 +365,7 @@ function Example() {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// Update the document title using the browser API
|
// Update the document title using the browser API
|
||||||
document.title = `You clicked ${count} times`;
|
document.title = `You clicked ${count} times`;
|
||||||
});
|
}, [count]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
|
@ -401,7 +401,7 @@ function FriendStatus(props) {
|
||||||
return () => {
|
return () => {
|
||||||
ChatAPI.unsubscribeFromFriendStatus(props.friend.id, handleStatusChange);
|
ChatAPI.unsubscribeFromFriendStatus(props.friend.id, handleStatusChange);
|
||||||
};
|
};
|
||||||
});
|
}, [props.friend.id]);
|
||||||
|
|
||||||
if (isOnline === null) {
|
if (isOnline === null) {
|
||||||
return 'Loading...';
|
return 'Loading...';
|
||||||
|
|
Loading…
Reference in New Issue