Skip to content
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

Project File Structure #21

Closed
ascasson opened this issue Oct 7, 2018 · 13 comments
Closed

Project File Structure #21

ascasson opened this issue Oct 7, 2018 · 13 comments
Labels
good first issue Good for newcomers Hacktoberfest Hacktoberfest issues ReactJS

Comments

@ascasson
Copy link
Owner

ascasson commented Oct 7, 2018

Basic apps always need some attention; let's organize this project a little. The project files should be structured by type, such as:

components/
    button/
        Button.js
        index.js
        style.css
    header/
    footer
pages/
@ascasson ascasson added good first issue Good for newcomers Hacktoberfest Hacktoberfest issues ReactJS labels Oct 7, 2018
@bhefty
Copy link
Contributor

bhefty commented Oct 7, 2018

I'm interested in tackling this one!

@ascasson
Copy link
Owner Author

ascasson commented Oct 7, 2018

Sweet! Go for it, @bhefty! Obviously the above is just an example; I'm open to ideas.

@bhefty
Copy link
Contributor

bhefty commented Oct 7, 2018

Thanks! What's your opinion on swapping pages for containers?

My thinking there:

components/
    button/
        Button.js
        index.js
        style.css
    header/
    footer
containers/
    App/
        index.js
        App.css
        tests/
            index.test.js
    Dashboard/
        index.js
        Dashboard.css
    ...

@ascasson
Copy link
Owner Author

ascasson commented Oct 7, 2018

@bhefty Do you find it feels like a clearer abstraction than Pages? I could go either way - sometimes good to voice the details.

@bhefty
Copy link
Contributor

bhefty commented Oct 7, 2018

@ascasson I think pages certainly signify a clear message of "whatever is in this directory is a page view", which to me means route based. However I'm wondering about the "container" type components which don't necessarily have anything to do with a particular page view. Like App, which may be the route management and overall main entry point of the application.

Do you anticipate the majority of larger "container" type components being tied to routes? If so I'm good with keeping pages. Calling them containers I think just sets it up a bit more for future cases where something like Redux is generally connected to a "container" not necessarily a "page".

Honestly the only reason I had this question is because of a rather large app I'm working on went with pages and we have several components within that aren't specifically "page" based so it's been a semantic battle trying to remember which directory contains the thing I'm wanting to change 😛

@bhefty
Copy link
Contributor

bhefty commented Oct 7, 2018

Or we can even take a step back and rather than having two primary directories (components/pages), it could be more feature based. Something like:

components/
    button/
        Button.js
        index.js
        style.css
    header/
    footer
App/
    index.js
    App.css
    tests/
        index.test.js
Dashboard/
    index.js
    Dashboard.css
    JobMetrics/
        index.js
        JobMetrics.css
    PostJob/
        index.js
        PostJob.css
    ...

I think this approach can result in deeper nesting, but it may also allow for things to become whatever they want to be (page view, smart container, helper functions, etc)

@ascasson
Copy link
Owner Author

ascasson commented Oct 7, 2018

@bhefty Seriously good points. Honestly, I say roll with the container structure. This app will be so small, even with future goals of incorporating payments. (Famous last words! Ha!)

At the end of the day, refactoring is always a thing haha

@bhefty
Copy link
Contributor

bhefty commented Oct 7, 2018

Haha, completely understand those sentiments! I'll get a basic structure over soon!

@ascasson
Copy link
Owner Author

ascasson commented Oct 7, 2018

@bhefty You rock! The help and thoughtful opinions are incredibly appreciated 💯

@ascasson
Copy link
Owner Author

ascasson commented Oct 7, 2018

@bhefty Just a heads up, a new contributor just dropped a PR with actual components, routers, and testing. I envision some merge conflicts headed your way...want some assistance? I think it should generally work with the basic structure you're creating.

@bhefty
Copy link
Contributor

bhefty commented Oct 8, 2018

@ascasson I saw this as soon as I submitted mine haha. Let me know how you want to proceed though and I can rebase mine to the new PR if conflicts arise.

@ascasson
Copy link
Owner Author

ascasson commented Oct 8, 2018

@bhefty lol the joys of community dev! I merged his PR, so there are now some conflicts. Those mods were looking great :)

@ascasson
Copy link
Owner Author

ascasson commented Oct 8, 2018

@bhefty Good stuffs, man! Thank you

@ascasson ascasson closed this as completed Oct 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers Hacktoberfest Hacktoberfest issues ReactJS
Projects
None yet
Development

No branches or pull requests

2 participants