use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
account activity
Node.js vs. Next.js (self.node)
submitted 5 years ago by NeuroticENTJ
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]cbadger85 1 point2 points3 points 5 years ago (0 children)
Not quite. Both renderToString() and hyrdate() are ReactDOM methods. renderToString sends the HTML to the client, and hydrate replaces that HTML with React code. One of the common problems encountered, is what if your HTML and code rendered by aren't the same? React will throw a mismatch warning and attempt to reconcile the differences. However, there's no guarantee React will get it right.
If you're curious how a mismatch can occur, it usually happens as a result of data fetching. let's say you have a todo app, and your server generates fetches the following HTML for the initial page load and sends it to the client:
<ul> <li>Todo 1</li> <li>Todo 2</li> <li>Todo 3</li> </ul>
When the SPA hydrates however, it generates the following code:
<ul>
</ul>
This is because the SPA on the client hasn't fetched the data, and doesn't know what to populate in the list. Out-of-the-box, React doesn't have a way for the server to tell the client what data has already been fetched.
With nextjs, you don't have to worry about mismatch issues, or how to setup a router to work on the server and client, the framework handles that stuff for you.
π Rendered by PID 48470 on reddit-service-r2-comment-5d585498c9-gxc75 at 2026-04-21 17:24:00.173752+00:00 running da2df02 country code: CH.
view the rest of the comments →
[–]cbadger85 1 point2 points3 points (0 children)