[英]react router server side rendering with rails
I am using React Js with rails 5.0 我正在使用带有Rails 5.0的React Js
Important Gems are 重要的宝石是
gem 'rails', '~> 5.0.2'
gem 'react-rails'
gem 'react-router-rails'
gem 'slim-rails'
my layout and page template is in slim and I am using coffee everywhere. 我的布局和页面模板很小,我到处都在喝咖啡。
I am facing lots of problem when I am using react router. 我在使用React Router时遇到很多问题。
List of questions are: 问题清单是:
I want to get a clean approach like angular where I can use module + controller + views in react. 我想得到一个像angular这样的干净方法,可以在react中使用模块+控制器+视图。 Can be it possible? 有可能吗
As now I am using react-router but the thing is that when it send request to the server so request comes to my action controller, action view and layout but does not load react components. 现在,我正在使用react-router,但事实是,当它向服务器发送请求时,请求就到达了我的动作控制器,动作视图和布局,但没有加载react组件。
I am not able to use new packages like react-validation( https://www.npmjs.com/package/react-validation ). 我不能使用像react-validation( https://www.npmjs.com/package/react-validation )这样的新软件包。 How can I use react packages. 如何使用React软件包。
In react routing I want to send request on server and then it loads components which is exist on that action view. 在反应路由中,我想在服务器上发送请求,然后加载该操作视图中存在的组件。
Suggest me for the best approach of using react js + rails 建议我使用React JS + Rails的最佳方法
Let's start with the basics, and I apologize if it sounds too basic. 让我们从基础开始,如果听起来太基础,我深表歉意。
You probably want to go down these paths: * Acquire the ability to code in JavaScript. 您可能想走这些路:*获得使用JavaScript进行编码的能力。 Running on the browser implies code in JavaScript. 在浏览器上运行暗含JavaScript代码。 * Use Rails only as a server side REST or GraphQL endpoint. *仅将Rails用作服务器端REST或GraphQL端点。 Alternately, use Rails to emit JavaScript and then use as REST or GraphQL endpoint. 或者,使用Rails发出JavaScript,然后用作REST或GraphQL端点。 * Non JavaScript code will not be able to use the latest JavaScript libraries. *非JavaScript代码将无法使用最新的JavaScript库。
It's good to think of the possibilities of what can be done, and this question suggests you are exploring. 最好考虑可以做什么,这个问题表明您正在探索。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.