Моя статистика` I tried it and it didn't work. I tried different methods on stackoverflow" /> Моя статистика` I tried it and it didn't work. I tried different methods on stackoverflow" /> Моя статистика` I tried it and it didn't work. I tried different methods on stackoverflow"/>

How do I add a link to a page using TypeScript? I'm stuck on how to do it. I've tried one method, but it's not working

27 views Asked by At
  `<CommandItem><a href="@/src/app/page.tsx">Моя статистика</a></CommandItem>`

I tried it and it didn't work. I tried different methods on stackoverflow and they also didn't help. I also tried doing it on the localhost but it didn't work (there).

1

There are 1 answers

0
jrnjy On

Try this method,

let commandItem = '<CommandItem><a href="@/src/app/page.tsx">Моя статистика</a></CommandItem>';

let newHref = 'https://example.com'; // Replace this with your link

commandItem = commandItem.replace(/href="[^"]*"/, `href="${newHref}"`);

console.log(commandItem);