/
githubmirror
/
immutable-js
Обзор
Документация
Войти
/
githubmirror
/
immutable-js
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
website/src/mdx-components/CodeLink.tsx
18 строк
366 B
Julien Deniau
Doc as mdx instead of export from .d.ts file (#2104)
24 май 2025, 00:47
Не верифицирован
24 май 2025, 00:47
21de701
Код
Авторство
О чём код?
import { JSX } from 'react'; type Props = { to: string; children?: React.ReactNode; }; export default function CodeLink({ to, children }: Props): JSX.Element { const href = to.includes('#') || to.startsWith('.') ? to : `#${to}`; const text = children || to.replace(/^[./]*/g, ''); return ( <a href={href}> <code>{text}</code> </a> ); }