Answer the question
In order to leave comments, you need to log in
What is the best way to pass and edit data in a Vue app?
Hello.
I am currently developing a vue application that works with multiple entities on the same page. For example, there is an order page, when it is opened from the back, information about the order, information about delivery, and information about the list of goods is pulled up for 3 different requests. Requests are sent and received independently of each other. Each request has its own boolean variable that shows the state of the request (isLoading, which is currently stored locally in the parent component, not in the store). Methods for pulling these requests are stored in 3 different Vuex modules, incoming data is also stored there.
Now the main problem. On the order page, there are again several independent components, each of which can use or change data from the response of any of the 3 main requests (order, delivery, goods). There are many such components and they can be nested into each other at several levels. Accordingly, it is necessary to somehow transfer data inside these components in an optimal way, as well as save their changes. I see 3 options:
Answer the question
In order to leave comments, you need to log in
Everything depends on the situation. Sometimes it’s much easier to throw with a prop than to write a bunch of code and pull data from their storage.
All three thoughts are quite adequate, but it is obvious that the third option fits much better .
Firstly: you see where the data is coming from, and you don’t run through the components and don’t look for where the legs grow from.
Secondly: if you need to pull up a dozen data, you will go crazy throwing them like callas from component to component, but through the storage you can not pull everything at once, but take the necessary action, leggings, mute and call it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question