Invalid href passed to router error after fresh installed create-next-app

后端 未结 6 541
盖世英雄少女心
盖世英雄少女心 2021-02-05 18:02

After installed nextjs app on my local machine using create-next-app I get this error in console Invalid href passed to router.

Does anyone kno

6条回答
  •  我在风中等你
    2021-02-05 18:22

    Yes, nextjs throws that error. Don't use the component at all if linking to an external source, for external links you can use tag. In your case we can conditionally render either a plain anchor tag or use the link component if the prop matches an internal route. For example:

    Link.indexOf('http') == 0 ? return(regular link) : return(...)
    

提交回复
热议问题