简体   繁体   English

实现链接 yii2 -> React js 的最佳方法是什么?

[英]What is the best way to implement a link yii2 -> React js?

What is the best way to implement a link yii2 -> React js?实现链接 yii2 -> React js 的最佳方法是什么?

In general, can this be done or do you need another tool?一般来说,这可以完成还是需要其他工具?

In general you can use React in any of server frameworks if you are using it for frontend.一般来说,如果您将 React 用于前端,您可以在任何服务器框架中使用它。 that has nothing to do with what technology you use on server.这与您在服务器上使用的技术无关。

short answer: it's almost same as including a jquery library简短回答:它几乎与包含 jquery 库相同

look at this example: http://jsbin.com/cuneha/1/edit?html,js,output看这个例子: http : //jsbin.com/cuneha/1/edit?html,js,output

<script src="react-0.13.1.js"></script>

That's react library那是反应库

Long answer: you might need react, react-dom and other libraries.长答案:您可能需要 react、react-dom 和其他库。 React is usually written in jsx. React 通常是用 jsx 编写的。 before you send to browser you might want to compile back into plain js.在发送到浏览器之前,您可能希望编译回纯 js。 babel, webpack/browserify is general tool used to bundle and convert this stuff. babel,webpack/browserify 是用于捆绑和转换这些东西的通用工具。

React architecture works best with single page framework. React 架构最适合单页框架。

你可以试试这个小部件。如果你对服务器端渲染感兴趣,它会很有帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM