I am interested into Isomorphic React with Go and I am looking for some good info for that topic, would appreciate your input.

polaris · · 548 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>Thanks :)</p> <hr/>**评论:**<br/><br/>shovelpost: <pre><p>I don&#39;t think you can truly have &#34;isomorphism&#34; unless you write everything in JavaScript.</p> <p>My recommendation is to keep the backend in pure Go and hone your skills in HTML/JavaScript/CSS for the frontend. There really is no other way. Everything else is just sweeping the problem (JavaScript) under the rug and pretending it doesn&#39;t exist.</p></pre>earthboundkid: <pre><p>You could choose a templating language that has Go and JavaScript ports, but it&#39;s highly likely you&#39;ll find the minor differences in production with unexpected bugs. </p></pre>cLnYze19N: <pre><p>The isomorphic aspect of React is that React, or <a href="https://facebook.github.io/react/docs/react-dom-server.html" rel="nofollow">ReactDOMServer</a> rather, can be run on a Node.js server due to React&#39;s JavaScript codebase and output a string via <code>renderToString()</code> or <code>renderToStaticMarkup()</code> no? I&#39;m still using the former with Koa, but...</p> <p>Wouldn&#39;t that mean that you&#39;d be looking for ReactDOMServer code written in Go, if you would want to run that on the server?</p> <p>Quickly Googling for it gives me:</p> <blockquote> <p><strong>go-starter kit</strong><br/> This project contains a quick starter kit for Facebook React Single Page Apps with Golang server side render via goja javascript engine</p> <ul> <li><a href="https://github.com/olebedev/go-starter-kit" rel="nofollow">Github, olebedev/go-starter-kit</a></li> </ul> </blockquote> <p>But <a href="https://github.com/dop251/goja" rel="nofollow">goja</a>, used by go-starter kit, seems to come with the following caveat:</p> <blockquote> <p>It is not a replacement for V8 or SpiderMonkey or any other general-purpose JavaScript engine as it is much slower.</p> </blockquote></pre>darksparkone: <pre><p>Actually you don&#39;t need any go binding. You should setup nodejs server alonh with go to conpile server side versions of templates, and I would expect nodejs to be the webserver itself. Go or any other language in this case is a separate API server which only ptovides data - not template rendering </p></pre>paul2048: <pre><p>1/ Download nodejs </p> <p>2/ run you JSX script from nodejs</p> <p>Why do you bother with Go at first place? It&#39;s like asking how to write isomorphic applications with PHP. While languages may have a Javascript engine extension the amount of bullshit you need to go through to make react work without Nodejs is not worth it, and you&#39;ll need to use webpack anyway.</p></pre>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

548 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传