Hacker Newsnew | past | comments | ask | show | jobs | submit | hughbetcha's commentslogin

To be fair, the article would be more aptly titled "Recursion without function names". In any recursion you need a way to reference the original function somehow. They're using a function parameter to accomplish that via indirection.


There are no names except function arguments.

No 'x=...'


Please reread my post. The function parameter is the name.


Do you know a language without argument names?


You're missing the point. Nevermind.


Would be useful if this project explained the difference between React and ReactServer. It seems they are as similar as Java and Javascript.

Instead of the render() method in React to output JSX, it appears that ReactServer uses getElements() for a similar purpose. So the entire model and object lifecycle is probably different as well?


React Server uses React; the page that has getElements is sort of a meta-React-component that has other specified behavior, as well as returning a React component to be mounted. So it renders the first page you visit on the server (for fast loading), then all subsequent pages are rendered on the client.


Thanks. That should be the very first line in the documentation.


Also should probably mention it's not worth the trouble.


Is each page pushed to the browser in a static fashion? Or does ReactServer implement minimal client DOM updates in a similar manner to React?


Each page is split into sections. Each section may wait for async data and API responses. When all the data arrives, the section is rendered as an HTML string.

The server streams each section's static HTML to the client as soon as it's ready, and after all prior sections are streamed.

The server also streams the async data to the browser. This avoids the latency of the client downloading some HTML, then downloading some JS, then making the requisite API calls for the page's data. (Think of it as a hacky version of HTTP Server Push.)

On the client-side, React and your JS are downloaded, React will recycle as much of the static DOM as possible (writing isomorphic JS isn't always easy), then take over and do its thing.


> Each page is split into sections. Each section may wait for async data and API responses. When all the data arrives, the section is rendered as an HTML string.

Where are these waiting sections? On the browser client or the server?

Is the React code that is to be rendered on the browser served up automatically by ReactServer?

I'm sure it's a wonderful framework, but a diagram is really needed to understand any of this.


So the client downloads the data twice? First embedded in HTML and then via an additional request?


Good question. No, the data is downloaded only once.

The server tells the client what requests it's making on the client's behalf.

If the client's JS tries to make a request for a URL that's already in-progress, the client's React-Server code will skip the request and return a promise of the server's streamed response instead.

If the client's JS tries to make a request for something, and the server IS NOT already handling it, then the client will send out an HTTP request, and React-Server will step out of the way.


Cette jpg est pas une pipe.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: