Thanks to visit codestin.com
Credit goes to github.com

Skip to content

"<Link>" in _document.js doesn't do client-side transitions #1874

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

Closed
Reggino opened this issue May 4, 2017 · 4 comments
Closed

"<Link>" in _document.js doesn't do client-side transitions #1874

Reggino opened this issue May 4, 2017 · 4 comments

Comments

@Reggino
Copy link
Contributor

Reggino commented May 4, 2017

First: thanks for this guys, this is awesome.

Second: It seems any React onClick-event handlers aren't installed client-side when given via the _document.js-file. This way, for example Link.onClick isn't fired for elements in the _document.js. Or in nested elements, e.g. in a menu on all pages...

This may be expected behaviour, but it took me a while to figure out why all <Link>'s would initiate a server-side transition.

@sedubois
Copy link
Contributor

sedubois commented May 4, 2017

AFAIK the custom document is not meant to contain <Link>s, but e.g to customize the <html> and <body>.

@Reggino
Copy link
Contributor Author

Reggino commented May 4, 2017

But i think its tempting to add something like a menu if that should be on all pages...

Maybe add a warning to the documentation?

@sedubois
Copy link
Contributor

sedubois commented May 4, 2017

Yes, I think a pull request to clarify that could be helpful. _document.js isn't meant to serve as a shared app layout. You can get that behaviour by wrapping each page in a HOC e.g like https://github.com/relatenow/relate/blob/master/hocs/page.js.

@arunoda
Copy link
Contributor

arunoda commented May 4, 2017

Thanks @sedubois for helping out.
Yeah! Having something in the docs would be nice.
It'd be great, if you can send us a PR.

@arunoda arunoda closed this as completed May 4, 2017
Reggino added a commit to Reggino/next.js that referenced this issue May 4, 2017
@lock lock bot locked as resolved and limited conversation to collaborators May 11, 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

3 participants