The official documentation says that there could be a data
and a props
option in a component.
For me it seems a sort of excessive functionality.
Why do I need both properties and data in my component? Which goals they are aimed?
What are Props in Vue. js? “Props” is a special keyword which stands for properties. It can be registered on a component to pass data from a parent component to one of its children components. This is a lot easier compared to using state management libraries like vuex for Vue.
What are props? In Vue, props (or properties), are the way that we pass data from a parent component down to it's child components. When we build our applications out of components, we end up building a data structure called a tree.
Using props in VueAfter you have set up the props, you can then use it inside your component as though the data was defined inside the same component. This means you can set up method calls and easily access this.
Components in Vue are composed of three parts; a template (which is like HTML), styles and JavaScript. These can be split into multiple files or the same .
Properties are meant to be propagated and managed from parent components, while data is the component internal state (which the component is responsible for).
This concept is taken from React as far as i know, and it works pretty well. https://github.com/uberVU/react-guide/blob/master/props-vs-state.md
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With