Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Having a separate "components" and "pages" folder feels bad, man. /: #24032

Closed
Johnrobmiller opened this issue Apr 13, 2021 · 1 comment
Closed

Comments

@Johnrobmiller
Copy link

Johnrobmiller commented Apr 13, 2021

Describe the feature you'd like to request

I'm aware that this is, technically speaking, a duplicate (#3728), but I think it's ok because the duplicates are a little bit old now.

The organization system required by Next.js feels lousy for many people, myself included. For reference, this is what I mean:

  • pages
    • page1.tsx
    • page2.tsx
    • ...
    • page[x].tsx
  • components
    • page1
      • [components]
    • page2
      • [components]
    • ...
    • page[x]
      • [components]

On the other hand, something like this would feel much nicer. Let's pretend that any files in the "lib" folder do not get rendered as pages:

  • pages
    • page1
      • index.tsx
      • lib
        • [components]
    • page2
      • index.tsx
      • lib
        • [components]
    • ...
    • page[x]
      • index.tsx
      • lib
        • [components]

Any updates on getting this implemented for 2021? I hate to be "that guy" who complains on github forums, but this seems like something that would be very easy to program into Next.js All the programmer would have to do is dynamically restructure the folder system of the 2nd example to be like the 1st when the code is being built.

Other than this one thing, I'm enjoying Next.js quite a bit, and cheers to the devs.

Describe the solution you'd like

(explained in the above section)

Describe alternatives you've considered

(explained in the above section)

@Johnrobmiller Johnrobmiller changed the title Having a separate "components" and "pages" folder feels bad man. /: Having a separate "components" and "pages" folder feels bad, man. /: Apr 13, 2021
@mnlfischer
Copy link

mnlfischer commented Apr 14, 2021

In a "component thinking way" what you should consider when using React, there is no need to separate components by pages. Do you have a specific use case why you do that? What about general components like buttons in your example? For me it makes totally sense to use a page as the rendered outcome composition where all your specific components are used.

@vercel vercel locked and limited conversation to collaborators Apr 14, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants