[英]Trying to add the custom HTML and JS code in react application in production
As in many SaaS application we provide admins to add custom HTML, CSS and JS directly from any backend form.与许多 SaaS 应用程序一样,我们提供管理员直接从任何后端表单添加自定义 HTML、CSS 和 JS。 It works perfectly in applications built without any JS framework like react or vue.它在没有任何 JS 框架(如 react 或 vue)的应用程序中完美运行。
I want to do the same with react application.我想对反应应用程序做同样的事情。 The solution that I am thinking can be-我正在考虑的解决方案可以是-
I may be wrong.我可能错了。 Please suggest me any possible way to make things in production react application.请向我建议任何可能的方法来使生产反应应用程序中的东西。
I really can't say anything about q1 .我真的无话可说q1 。 But for q2 it is not a good option to add code in index.js file even if it runs locally.但是对于q2 ,即使它在本地运行,在index.js文件中添加代码也不是一个好的选择。 It is not a good practice to write all your code in index.js or App.js .在index.js或App.js中编写所有代码并不是一个好习惯。 Trying to make components and write cleaner code is the beauty of React .尝试制作组件并编写更简洁的代码是React的美妙之处。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.