Skip to content
Discussion options

You must be logged in to vote

The CSS :target selector can do that, https://codepen.io/matude/pen/OQrryP

Edit: Always a harsh reminder that:

This event does not fire when the hash is modified using history.pushState() or history.replaceState().

That means that a plain <a> would do, but IIRC it doesn't play nicely with the fwd/back, might be wrong there.

"use client";

import Link from "next/link";
import { usePathname, useSelectedLayoutSegment } from "next/navigation";
import { useEffect, useState } from "react";

interface Props {
  href: string;
  title: string;
}

export default function NavigationLink({ href, title }: Props) {
  useSelect…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@jtuchel
Comment options

@icyJoseph
Comment options

Answer selected by icyJoseph
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants