InterviewSolution
| 1. |
Passing of data from a primary component to a secondary component is a common feature for Vue.js and Angular.js. How would you achieve data pass from parent to child component in Vue.js? |
|
Answer» Just like in the real world, parents are viewed as a source of knowledge or better less more experience. A child seeks more information from a parent and the parent either teaches or writes down steps and procedures to be followed. In the development world and as in our case, Vue.js FRAMEWORK, DATA is passed to a child component through attributes or as attributes. Data can be passed inline or using the component method. Methods are the reusable vue requests that separate the code and the modular. Its incorporation has helped to reduce REPETITIONS. Props are the most commonly used passage. They are one way inlets in the component. <Script> Export default { Name: ‘child’, Props: { parentData: Object, stringProp: String, title: String } } </script>In the above example, the prop is declared in the child section for it to appear as a normal variable. |
|