Simplified context with hooks

This commit is contained in:
maciekglowacki 2020-06-29 22:43:50 +02:00
parent 5b153d11cf
commit 51ee8c44fa
2 changed files with 4 additions and 4 deletions

View File

@ -13,7 +13,7 @@ function App() {
const [isOpenTransfer, setOpenTransfer] = useState(false);
const [text, setText] = useState("");
const businessLogicContext = useContext(BusinessLogicContext);
const { logout } = useContext(BusinessLogicContext).actions;
return (
<div className="App">
@ -28,7 +28,7 @@ function App() {
console.log(e);
}}
handleLogout={() => {
businessLogicContext.actions.logout();
logout();
}}
/>
<Transfer

View File

@ -13,7 +13,7 @@ interface RightBarProps {
export default function RightBar({ lectures, onGroupMouseOver, onGroupClick }: RightBarProps) {
const [selectedCardId, setSelectedCardId] = useState<string | null>(null);
const businessLogicContext = useContext(BusinessLogicContext);
const ticket = useContext(BusinessLogicContext).user?.ticket;
const onCardClick = (e: React.MouseEvent) => {
const target = e.currentTarget as HTMLElement;
@ -22,7 +22,7 @@ export default function RightBar({ lectures, onGroupMouseOver, onGroupClick }: R
return (
<div className="right-bar">
<p>{businessLogicContext.user?.ticket}</p>
<p>{ticket}</p>
<div className="right-bar__text">
Hubert Wrzesiński<br></br>
Semestr zimowy 2020/2021