Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Link next/prefetch TypeError #725

Closed
intermundos opened this issue Jan 10, 2017 · 8 comments
Closed

Link next/prefetch TypeError #725

intermundos opened this issue Jan 10, 2017 · 8 comments

Comments

@intermundos
Copy link

intermundos commented Jan 10, 2017

Hi,

I get following error in console while using Link from next/prefetch. Though, the link is working and goes to other page.

Parameter 'url' must be a string, not undefined.

Just installed next and run npm run dev.

@impronunciable
Copy link
Contributor

Hi @intermundos can you paste the error information from the devtools/provide more information? thanks

@intermundos
Copy link
Author

intermundos commented Jan 10, 2017

@impronunciable hi, this is the error I get in console.

I have created 2 pages, index and home, on index page I put link to home pages and nothing else.

url.js?d390d15:112Uncaught (in promise) TypeError: Parameter 'url' must be a string, not undefined at Url.parse (http://localhost:3000/_next/commons.js:3988:11) at urlParse (http://localhost:3000/_next/commons.js:3982:5) at getPrefetchUrl (http://localhost:3000/_next/commons.js:11797:34) at _callee$ (http://localhost:3000/_next/commons.js:11599:19) at tryCatch (http://localhost:3000/_next/commons.js:15901:40) at Generator.invoke [as _invoke] (http://localhost:3000/_next/commons.js:16192:22) at Generator.prototype.(anonymous function) [as next] (http://localhost:3000/_next/commons.js:15953:21) at step (http://localhost:3000/_next/commons.js:2647:30) at http://localhost:3000/_next/commons.js:2665:14 at F (http://localhost:3000/_next/commons.js:1675:28)

@intermundos
Copy link
Author

Also, please tell me what information you need and I will gladly provide it.

Thanks.

@impronunciable
Copy link
Contributor

@intermundos Tried to reproduce and couldn't. Is it possible to see the code of your page?

@intermundos
Copy link
Author

intermundos commented Jan 10, 2017

This is index page with the link. Home page is the same but without the link part :)

import React from  'react'
import Link        from 'next/prefetch';

export default class extends React.Component {


	render (){
		return (
			<div>
				<div>Hello world!</div>
				<Link><a href="/home">Home</a></Link>
			</div>
		)
	}
}

@impronunciable
Copy link
Contributor

impronunciable commented Jan 10, 2017

Oh, try moving the href='/home' to the link:

	render (){
		return (
			<div>
				<div>Hello world!</div>
				<Link href="/home"><a>Home</a></Link>
			</div>
		)
	}

@intermundos
Copy link
Author

Oh my eyes. Thanks.

@impronunciable
Copy link
Contributor

Glad it worked

@lock lock bot locked as resolved and limited conversation to collaborators May 12, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants