-
Notifications
You must be signed in to change notification settings - Fork 116
Is this SSR ready out of the box? #91
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
Comments
react-media probably would not work with SSR, as long it does not provide methods to mock environment, and not match anything if you dont have If you are looking for SSR-friendly media-matcher - take a look on https://github.com/thearnica/react-media-match |
We use this lib with SSR, I explained our workflow here: #50 (comment) |
@daydream05 I didn't read your original message properly. But getting this to work with Gatsby with your pre-rendered HTML will be impossible, since AFAIK Gatsby produces the HTML files at build time, at which point you have no information which device will be served. I'm not familiar with Gatsby, but the only option I can think of is to render multiple versions of your site, but now you'll have to figure out how to serve the correct version to the correct user. You'll probably be better off with just picking a default (i.e. mobile), which will be rendered to your static HTML. And then let |
The problem with React-media+SSR is ... the absence of documentation. |
We've just merged the PR with SSR docs! |
I was having this same issue on a Gatsby site I had planned on launching today. The problem with Gatsby SSR is that the static pages are created at build time so there's no opportunity to evaluate the client hitting the server to setup I don't have much SSR experience and don't know exactly how Again, I'm no SSR expert and don't know how your
The premise of the trick (for those finding this and don't see it) is that HoweverThis got me thinking about what if I changed I went to fork and change and ran tests and I get one test that fails which I'm not sure how you want to solve. Here's the test line number I think it fails because with In any case, this whole problem is fixed if we can change to |
Hi @bradwestfall 👋, thanks for your detailed write-up. First of all, we are planning to move to
I think I figured this one out. Since I guess this problem is one of the motivations of deprecating |
Thanks for the fast response. Any idea on a timeframe? |
Sorry, can't be sure about a timeline. @mjackson is a busy man, and I'd like to pass these changes by him before publishing. |
I use Gatsby JS and was wondering if I need to do any modifications if I need this to work for SSR. Thanks
The text was updated successfully, but these errors were encountered: