How to decide between Pages, Components and Layouts in Nuxt

up:: Nuxt

How to decide what to put where

  1. Default to Nuxt Pages * Get things to work, then get it to work well
  2. Move common pieces to Nuxt Layouts
    • As you notice common code, pull it into Layouts
    • “Rule of Three”: You want to see code repeat thrice before adding the abstraction
  3. Smaller pieces become Vue Components
    • Move code from Pages or Templates into new Components
    • Components do one thing, Layouts often do multiple things

“Refactor iteratively”