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

preact-router doesn't properly render on server #1

Open
markusenglund opened this issue May 14, 2018 · 1 comment
Open

preact-router doesn't properly render on server #1

markusenglund opened this issue May 14, 2018 · 1 comment

Comments

@markusenglund
Copy link

markusenglund commented May 14, 2018

Hey, I just wanted to clue you in on the fact that preact-router doesn't really work when server rendering. I've been looking around for how to do it, and it doesn't seem like it's supported. You'll notice when you open your app at the "/about" route, that the server renders the "/" route, and then javascript on the client goes ahead and changes it. So the about page is never rendered on the server, which kind of defeats the purpose of ssr.

I made the same mistake since it's hard to notice that anything is out of order.

I think the best way to do ssr with preact is to just stick with good old react-router.

@markusenglund
Copy link
Author

I was wrong, it is supported in preact-router. You just have to pass the url to the router like described here: preactjs/preact-router#207

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant