Skip to content

Instantly share code, notes, and snippets.

@popeating
Created June 4, 2023 13:14
Show Gist options
  • Save popeating/ea01603763607da9b0232b04f1539cfe to your computer and use it in GitHub Desktop.
Save popeating/ea01603763607da9b0232b04f1539cfe to your computer and use it in GitHub Desktop.
import React from 'react';
import { useSelector } from 'react-redux';
import Link from 'next/link';
const Header = () => {
const totalValue = useSelector((state) => state.totalValue);
const totalItems = useSelector((state) => state.totalItems);
return (
<div className="w-full bg-slate-200 py-4 ">
<div className="container mx-auto flex justify-between">
<div>
<Link href="/" className="font-extrabold">
MY-COOL-SHOP
</Link>
</div>
<div className="font-light uppercase">
<Link href="/about">About</Link>
&nbsp; |&nbsp;
<Link href="/cart">Cart</Link>: ${totalValue} / {totalItems}
</div>
</div>
</div>
);
};
export default Header;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment