Skip to content

Instantly share code, notes, and snippets.

@YasirGaji
Last active November 14, 2023 00:51
Show Gist options
  • Save YasirGaji/d4d8e50b286e2a37ba8ce8737218900e to your computer and use it in GitHub Desktop.
Save YasirGaji/d4d8e50b286e2a37ba8ce8737218900e to your computer and use it in GitHub Desktop.
New way to render lists by using the declared static constants
import { leftsidebarLinks } from '@/constants';
type INavLink = {
imgURL: string;
route: string;
label: string;
};
const LeftSidebar = () => {
return (
<nav className='leftsidebar'>
<ul className='flex flex-col gap-6'>
{leftsidebarLinks.map((link: INavLink) => {
return (
<li key={link.label} className='leftsidebar-link'>
<NavLink to={link.route}>
{link.label}
</NavLink>
</li>
)
})}
</ul>
</nav>
)
}
export default LeftSidebar;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment