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

Improve component organization #6

Open
5arias opened this issue Aug 12, 2018 · 0 comments
Open

Improve component organization #6

5arias opened this issue Aug 12, 2018 · 0 comments

Comments

@5arias
Copy link

5arias commented Aug 12, 2018

As your app scales you'll find that having a long list of files and resources in the components directory will be increasingly cumbersome and difficult to navigate.

It's a good practice to separate out your components based on how they are used: pages, charts, etc, etc. You'll often find that most apps will have a components directory for the "lowest level" or "dumb components", and a containers directory for pages and "composed" level components.

There's no hard an fast rule, but organizing all your components by type, and even into their own named directory, will make your code structure significantly easier to navigate as you scale.

src
├── components
│   ├── Form
           ├── Form.js
           ├── Form.test.js
           ├── Form.css
│   ├── NavBar
           ├── NavBar.js
           ├── NavBar.test.js
           ├── NavBar.css
└── containers
    ├── App
        ├── App.js
        ├── App.test.js
        ├── App.css

"Containers" is common due to the early belief that connecting to redux was done at the App or parent/page level as a best practice. Nowadays it's best practice to connect at the lowest component level possible. However the component & containers naming conventions are still widely used as the standard, especially when using Redux.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant