Add deps to useEffect

This commit is contained in:
Kier Borromeo 2020-04-04 04:54:30 +08:00 committed by GitHub
parent 447de944e4
commit a652d427eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -365,7 +365,7 @@ function Example() {
useEffect(() => {
// Update the document title using the browser API
document.title = `You clicked ${count} times`;
});
}, [count]);
return (
<div>
@ -401,7 +401,7 @@ function FriendStatus(props) {
return () => {
ChatAPI.unsubscribeFromFriendStatus(props.friend.id, handleStatusChange);
};
});
}, [props.friend.id]);
if (isOnline === null) {
return 'Loading...';