[Vuejs]-How to pass state and events handlers as props to children components with Vue.js's Router?

0👍

After using Vue-router for a short period of time, I concluded that this is not a limitation, but more like a design decision:

  • React-router: is more like a condional renderer, e.i from within the parent component and based on the current path, render the apporopriate child.

  • Vue-router: is more like a wiring solution.

Also I have to say: a similar behavior to React-router can be achieved using Vue-router. This by combining the router’s currentRoute property with the v-if directive, which truly insert/remove a component from the DOM (not hiding it using css as v-show do).

Finally: seprating routes configuration is advantegeous, as it yield more modular project and better SPA. Of-course this separation can be done in both Vue-router and React-router (look here for React-router).

Leave a comment