UNPKG

@datalayer/core

Version:

[![Datalayer](https://assets.datalayer.tech/datalayer-25.svg)](https://datalayer.io)

20 lines (19 loc) 687 B
import { jsx as _jsx } from "react/jsx-runtime"; /* * Copyright (c) 2023-2025 Datalayer, Inc. * Distributed under the terms of the Modified BSD License. */ import { forwardRef, useCallback } from 'react'; import { useNavigate } from '../../hooks'; /** * Navigation link for primer NavList * Works with React Router, Next.js, or native browser navigation */ export const NavLink = forwardRef(({ to, children, ...props }, ref) => { const navigate = useNavigate(); const onClick = useCallback((e) => { e.preventDefault(); navigate(to); }, [to, navigate]); return (_jsx("a", { ref: ref, href: to, ...props, onClick: onClick, children: children })); });