Skip to content

Instantly share code, notes, and snippets.

@AlanJenkinsVS
Created April 16, 2018 15:43
Show Gist options
  • Save AlanJenkinsVS/b1f3532b9f19cf7b8548861a74b235e5 to your computer and use it in GitHub Desktop.
Save AlanJenkinsVS/b1f3532b9f19cf7b8548861a74b235e5 to your computer and use it in GitHub Desktop.
4. Cleaner Views - Vue JS Optimisation
/*
Add a key to router view. This tells Vue to re-render the view from scratch.
While this has negligibly worse performance from route to route it does simplify the
component as you no longer need to reset starting variables, etc within the component.
*/
<router-view :key="$route.fullPath"></router-path>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment