Skip to content

Instantly share code, notes, and snippets.

@hieptl
Created August 11, 2021 12:01
Show Gist options
  • Save hieptl/28f7d1f92e98d21322b45876918bdecd to your computer and use it in GitHub Desktop.
Save hieptl/28f7d1f92e98d21322b45876918bdecd to your computer and use it in GitHub Desktop.
// import useContext to get share data.
import { useContext } from 'react';
// import Context.
import Context from '../Context';
function RightSidebar() {
const { selectedContact } = useContext(Context);
if (!selectedContact) {
return (
<div className="rightsidebar">
</div>
);
}
return (
<div className="rightsidebar">
<img src={selectedContact?.contactAvatar} />
<p>{selectedContact?.contactName}</p>
</div>
);
}
export default RightSidebar;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment