Egg: Support server-rendered React

Created on 7 Feb 2017  ·  16Comments  ·  Source: eggjs/egg

Most helpful comment

强烈建议使用 next.js 作为 react 渲染方案😘,是因为作为 view 使用 react 没有如 ejs 那样简单。

前端构建都是一个复杂的过程。而 next.js 已经把相应的坑踩遍,两者搭配起来应该更好。

如果单独写一个 egg-view-react。那又有什么意义呢?那样又要重新踩一遍坑,不容易适应各种需求,而且迟迟不能稳定。

@popomore

All 16 comments

额,单元测试,不然没法跑
Eward Song notifications@github.com于2017年2月11日 周六20:28写道:

这个还用 babel-registry 了,
https://github.com/eggjs/egg-view-react/blob/master/test/fixtures/apps/view-react-test/app/controller/test.js
,这样不好吧


You are receiving this because you commented.

Reply to this email directly, view it on GitHub
https://github.com/eggjs/egg/issues/328#issuecomment-279140847, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAWA1ReloGtYdoXKr4QokxhMfss4XiIrks5rbaligaJpZM4L5eeQ
.

建议出
1.egg-view-next(react)
2.egg-view-nuxt(vue2)

egg-next看到有人写了一个egg-next来做这个事情

强烈建议使用 next.js 作为 react 渲染方案😘,是因为作为 view 使用 react 没有如 ejs 那样简单。

前端构建都是一个复杂的过程。而 next.js 已经把相应的坑踩遍,两者搭配起来应该更好。

如果单独写一个 egg-view-react。那又有什么意义呢?那样又要重新踩一遍坑,不容易适应各种需求,而且迟迟不能稳定。

@popomore

之前 next.js 1.x 的时候,好像对 koa 的支持不好,要 hack 的方式,现在不知道怎么样了。

可以单独写个 egg-nextjs

我前一阵子研究 next.js 的时候还是不支持 koa 的,现在 koa 接入 next 都是通过设置 ctx.responed = false 后交由 next.js 处理响应,这个模式在 koa(egg) 下会导致很多中间件失效。

基于Egg + React + Webpack3/Webpack2 多页面和单页面服务端渲染同构工程骨架项目: https://github.com/hubcarl/egg-react-webpack-boilerplate

Hi, I am working on https://github.com/djyde/serlina and its Egg binding https://github.com/serlina-community/egg-serlina I think this is the best serverside-rendering solution for Egg application!

https://medium.com/@djyde/serlina-a-progressive-react-serverside-rendering-framework-a4de2d71d984
https://medium.com/@djyde/egg-serlina-%EF%B8%8F-533493862698

@djyde cool~ could add it to https://github.com/eggjs/awesome-egg

@djyde serlina look beautiful!

Hi,

I've been working on a _EggJS plugin_ that integrates _NextJS_. egg-frost

I have been able to set this plugin and render pages using NextJS render engine (in development mode).

I hope it helps. Feedback is always welcome 😄

Hi,

I've been working on a _EggJS plugin_ that integrates _NextJS_. egg-frost

I have been able to set this plugin and render pages using NextJS render engine (in development mode).

I hope it helps. Feedback is always welcome 😄

Read the document but don't use

@dead-horse 给个导致很多中间件失败的demo ,如果导致了你怎么处理的?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Ailein picture Ailein  ·  3Comments

Webjiacheng picture Webjiacheng  ·  3Comments

yuu2lee4 picture yuu2lee4  ·  3Comments

bupafengyu picture bupafengyu  ·  3Comments

Quekie picture Quekie  ·  3Comments