Anyone who can explain me components/layouts/pages relationship please

  • Hi
    i am a little confused, i read the documentation and i understand that layouts has pages are injected using the router… then i read layouts are components but if so why directory structure is as follows in src directory:

    • components/

    • layouts/

    • pages/

    i can not understand what’s the difference between layouts and components, what should i save in each directory?

    thanks in advance…

  • Components are used by Pages, Pages are used by Layouts. There are no hard and fast rules here. This just really helps to organize your code.

  • ok, thanks for answer

  • a more detailed answer to this question would be REALLY nice since I have the same confusions

  • All are components regardless, they are just organized in certain folders as explained by @Hawkeye64 . Layout is the parent component of your route it usually hold a page, both can have components coming from the Components folder. Think like a hierarchy of Layout > Page.

Log in to reply