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

Directory structure #106

Closed
srghma opened this issue Aug 11, 2017 · 1 comment
Closed

Directory structure #106

srghma opened this issue Aug 11, 2017 · 1 comment

Comments

@srghma
Copy link
Contributor

srghma commented Aug 11, 2017

I suggest

 ~/projects/ran   jest  tree -L 1 --dirsfirst pages components containers libraries libraries/stores components/AuthFields
pages
├── create.js
├── details.js
├── _document.js
├── index.js
├── signin.js
└── signup.js
components
├── AuthFields
├── LinkList
└── Theme.js
containers
├── CreatePost
├── Header
├── PostInfo
├── PostList
├── PostUpvoter
├── SignInForm
├── SignUpForm
├── App.js
└── Default.js
libraries
├── graphql_schemas
├── stores
├── apolloClient.js
├── helpers.js
├── middleware.js
├── persist.js
├── redirect.js
├── reducer.js
├── reduxStore.js
├── theme.js
├── validations.js
└── withData.js
libraries/stores
└── auth.js
components/AuthFields
├── index.js
├── styles.js
└── validation.js
  1. If component is using data from apollo or redux - its container
  2. Locate stores (reducers, actions,...) separately from components/containers ( libraries/stores or libraries/modules)

@Sly777 you said you have some concerns

@srghma
Copy link
Contributor Author

srghma commented Aug 12, 2017

Also I dont like when components consist of

  1. data.js - which export function connect which is wrapper that connect components to store or apollo
  2. index.js - component and export default connect(Component) in the end

better

  1. feature.js - component, not yet attached to data (also can split feature to feature.js(smart) and presentation.js(dumb))
  2. index.js - import feature and attach it to data

Why? for testing, first example force us to test component attached to data, with second we have option to test component only or component with data

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

No branches or pull requests

2 participants