From 07cf1cd1e8e77bdd5f44481af3067d06382c97e1 Mon Sep 17 00:00:00 2001 From: Kamil Tomsik Date: Tue, 16 Apr 2024 23:05:57 +0200 Subject: [PATCH] update { * A wrapper around the Link component that adds an active class to the * link when the route is active. **/ -export const NavLink = ({ href, activeClass = "active", exact = false, ...props }) => { +export const NavLink = ({ href, class: className = "", activeClass = "active", exact = false, ...props }) => { // Touch the currentRoute to subscribe to changes router.currentRoute - if (router.match(exact ? href : `${href}*`)) { - props.class = (props.class ?? props.className ?? "") + " " + activeClass - } + const active = router.match(exact ? href : `${href}*`) - return + return }