Static GitHub Issues

[320] Code duplication

prev: The client-side rendered virtual DOM tree is not matching server-rendered content
next: nuxt.config variable in layouts

Hi,

Is there a way in nuxt by which I call the same set of lines when app is server side rendered i.e. calling code from apps data method and the same code when the app is client side rendered i.e. calling code present in a watch without writing the same code twice.

It is an obvious use case for dynamically identifying weaker server or weaker client delivering the optimum UX.

<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c275">#c275</a>)</em></sub></div>