How to make modular components in Vue? (Coming from React) #13185
-
So I started to learn VueJS coming from a React background and I ended up coming across the need to make a component, and I wanted it to be as flexible as possible, so I decided to take a modular approach. The problem is: The modular approach I know of utilizes of JSX capabilities, which is not VueJs's approach. I know JSX is usable in VueJs for some options to use/allow it in projects, but I wanted to know if there's a similar approach that is 100% native to VueJs and as good, simple and effective as it is in React. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
It might be helpful to have an example of what you consider to be a "modular component" (a React example is fine). The term "modular" can be read to mean a lot of different things. |
Beta Was this translation helpful? Give feedback.
-
You can do something like this when you use .vue files: Playground The limiting factor here is that .vue files require to have one file per component. You can do pretty much what you do in React in Vue, when you are willing to use JSX. |
Beta Was this translation helpful? Give feedback.
You can do something like this when you use .vue files: Playground
The limiting factor here is that .vue files require to have one file per component. You can do pretty much what you do in React in Vue, when you are willing to use JSX.