javascript - 如何将 Reactjs 与 Nodejs 结合使用,发送 html(组件)以响应 API

标签 javascript node.js reactjs server-side-rendering bigcommerce

我正在致力于使用 NodeJs 和 Reactjs 技术堆栈创建 Bigcommerce 应用程序。

在 BC(Bigcommerce) API 响应中,他们期望在 Iframe 中呈现的 html 来显示应用程序市场商店(实际应用程序运行的地方)中的内容。

I have already created react/node app running well on EC2 instance. I just want to reuse the react part (component and other routing etc) here in this BC app. But as I see i need to send the HTML from node(server side) app, so either I need to use server side rendering engine like jade/hbs etc, or use react as SSR. If i am doing the same i need to do lots of rework to use the same components and render the same from server side.

无论如何,我可以直接在我的 BC 应用程序中使用我的 React 代码,或者以某种方式渲染 React 组件,而无需进行太多更改。

我被困在这里,任何帮助将不胜感激。

最佳答案

Next js 是 React 应用程序的 SSR,你可以研究一下 https://nextjs.org/

关于javascript - 如何将 Reactjs 与 Nodejs 结合使用,发送 html(组件)以响应 API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59926972/

相关文章:

javascript - 在提交时将日期格式从 dd M yy 更改为 "2015-01-28T00:00:00+00:00"datepicker

node.js - 如何使用 Node.js 获取 Google Cloud Storage 文件夹中的文件列表?

javascript - 在 ReactJS 中,渲染组件时,服务端执行哪些步骤,客户端执行哪些步骤?

javascript - angular ui 错误 : $modal. open is not a function

Javascript 生成器问题 - 解释这段代码

javascript - Jquery draggable with bootstrap modal, scroller 奇怪的行为

node.js - Mongojs - 如何推送到数组?

javascript - 如何在 JavaScript 中获取字符串中的有效对象?

javascript - 如何下载查询需要JS处理的html页面?

javascript - 在 MVC 路由之上构建一个具有反应的 SPA