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

server side rendering? #217

Open
jantimon opened this issue Jan 8, 2021 · 6 comments
Open

server side rendering? #217

jantimon opened this issue Jan 8, 2021 · 6 comments

Comments

@jantimon
Copy link

jantimon commented Jan 8, 2021

does fre provide ssr and hydration like preact and react?

@yisar
Copy link
Collaborator

yisar commented Jan 8, 2021

I do have a good idea to do SSR, but it's not easy

Do you know react server component? It has no states and events and does not need hydration.

In the past, SSR traverses vdom to generate html strings, which has poor performance in the server.

But if we compile JSX into bytecodes, there will be a great performance improvement.

This is feasible on the premise that the component is the same as the server component and has no state.

In other words, we can do ssr of server component at the same time, which has four advantages:

  1. Efficient bytecode

  2. Because the server component has no state, it doesn't need to hydration.

  3. Smaller bundle size.

  4. If we can learn from angular ivy, we can do more tree shaking.

https://github.com/trueadm/react-compiler/blob/master/browser-sandbox/build/compiled-bundle.js

@trueadm has done similar work, and I'd like to try it. Maybe it's a good idea.

@yisar
Copy link
Collaborator

yisar commented Apr 19, 2021

@jantimon I am paying close attention to react fizz. Its implementation is very interesting and suitable for fre.
https://github.com/facebook/react/tree/master/packages/react-server

@jantimon
Copy link
Author

cool :) looking forward on your findings

@tomByrer
Copy link

Any new ideas yet?

@yisar
Copy link
Collaborator

yisar commented May 28, 2021

@tomByrer I do have a lot of ideas here, but it takes time and I may need a summer vacation.

  1. Streaming rendering, which is the most important, enables SSR to support suspend interaction.

facebook/react#20970

  1. ESR, Deploying in cloudflare worker, and developing in labor

I'm a little busy recently, so the progress will be slow. If someone helps me, that would be great. Thank you.

@snakeUni
Copy link

snakeUni commented Jun 1, 2021

In the past, SSR traverses vdom to generate html strings, which has poor performance in the server.

are there some poor performance examples about renderToString?

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

4 participants