Skip to content

Instantly share code, notes, and snippets.

@treyhuffine
Last active July 5, 2020 03:04
Show Gist options
  • Save treyhuffine/3b8a82a7c72fcff4708feb7e9eb56729 to your computer and use it in GitHub Desktop.
Save treyhuffine/3b8a82a7c72fcff4708feb7e9eb56729 to your computer and use it in GitHub Desktop.
import * as React from 'react';
import useFriendStatus from './useFriendStatus';
interface IUser {
id: number;
username: string;
}
const FriendsListItem ({ user }) => {
// We know this value is a boolean since we defined our hook
const isOnline = useFriendStatus(user.id);
return (
<li>
<span style={{ backgroundColor: isOnline ? 'green' : 'red }} />
<span>
{user.username}
</span>
<li>
);
};
@refo
Copy link

refo commented Jul 4, 2020

On line 11; hook call should be useFriendStatus instead of userFriendStatus with a reduntant r letter. 

@treyhuffine
Copy link
Author

On line 11; hook call should be useFriendStatus instead of userFriendStatus with a reduntant r letter.

Thanks! It's been fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment