Using React.js and Vue.js Together in Laravel

独自空忆成欢 提交于 2019-12-11 17:57:25

问题


I really want to know, is it possible to using react.js and vue.js next to each other in a laravel?
For Example, use ReactJs for admin dashboard and use VueJs for client dashboard. I know it's technically and logically better to use one of them.
What do you think? Can we use them together?


回答1:


Yes. It is definitely possible. Polyglot programming is today's reality. There are a couple of approaches you can take. A most common approach would be that of a micro-frontends.

How you implement micro-frontend is up to you! But in general, you will have two different SPA served on two different routes. You will interlink these two applications using hyperlinks/anchor tags. However, note that, doing something that is a big cost and really meant for very large applications and teams building them.

There are many leaf components like buttons, links, dropdown, etc. which you will end up developing and maintaining for both frameworks. State management, routing, services will be rewritten for each framework. It is incredibly painful to match consistent style guide across frameworks.

Nowadays, if you really need to go ahead with this approach, you can consider using custom-elements for your leaf components. They should work for many SPA frameworks (see the notes). This will help you save the trouble of reinventing the wheel.

Note: React is not very friendly with web-components. It fails on many advanced tests.



来源:https://stackoverflow.com/questions/56429109/using-react-js-and-vue-js-together-in-laravel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!