Knowledgebase

Vue and Nuxt: Everything That Matters, Briefly Print

  • frontenddevelopment, frontend, guide, howto, solution, zillionkinghost, hosting, support
  • 0

The summary.

VUE CAN ENHANCE PART OF A PAGE OR BUILD A WHOLE APPLICATION

Which means it can be introduced without rewriting everything.

Prefer the composition approach for new work — it reuses logic more easily.

KEEP LOGIC OUT OF TEMPLATES

Move expressions into computed values. Templates describe structure.

USE COMPUTED VALUES FOR ANYTHING DERIVED, AND WATCHERS ONLY FOR SIDE EFFECTS

That prevents storing derived values in state, where they diverge from their source.

THE REACTIVITY TRAP

Destructuring a reactive object produces plain copies, disconnected from the source. Use the helper that preserves the connection.

IN COMPOSABLES, STATE DEFINED OUTSIDE THE FUNCTION IS SHARED BY EVERY CALLER

Sometimes intended, frequently not. Decide deliberately.

IN NUXT, ESTABLISH WHICH CODE RUNS WHERE

Secrets in code that also runs in the browser are exposed, and naive fetching in a universal application requests everything twice.

NEVER USE A PLAIN SHARED OBJECT FOR STATE IN A SERVER-RENDERED APPLICATION

On the server it is shared between requests, and therefore between users.


Was this answer helpful?
Back

Are you happy with your experience? Leave us a review on Trustpilot.


Trustpilot