Last active
September 7, 2022 07:36
-
-
Save ryanflorence/110d4538bf98694538de to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
. | |
├── actions | |
├── stores | |
├── views | |
│ ├── Anonymous | |
│ │ ├── __tests__ | |
│ │ ├── views | |
│ │ │ ├── Home | |
│ │ │ │ ├── __tests__ | |
│ │ │ │ └── Handler.js | |
│ │ │ └── Login | |
│ │ │ ├── __tests__ | |
│ │ │ └── Handler.js | |
│ │ └── Handler.js | |
│ └── SignedIn | |
│ ├── __tests__ | |
│ ├── lib | |
│ │ └── components | |
│ │ ├── __tests__ | |
│ │ └── Avatar.js | |
│ ├── views | |
│ │ ├── Courses | |
│ │ │ ├── __tests__ | |
│ │ │ ├── views | |
│ │ │ │ ├── Assignments | |
│ │ │ │ │ ├── __tests__ | |
│ │ │ │ │ └── Handler.js | |
│ │ │ │ ├── Default | |
│ │ │ │ │ ├── __tests__ | |
│ │ │ │ │ └── Handler.js | |
│ │ │ │ ├── Grades | |
│ │ │ │ │ ├── __tests__ | |
│ │ │ │ │ └── Handler.js | |
│ │ │ │ └── Users | |
│ │ │ │ ├── __tests__ | |
│ │ │ │ └── Handler.js | |
│ │ │ └── Handler.js | |
│ │ └── Dashboard | |
│ │ ├── __tests__ | |
│ │ ├── components | |
│ │ │ ├── __tests__ | |
│ │ │ ├── Stream.js | |
│ │ │ ├── StreamItem.js | |
│ │ │ ├── TodoItem.js | |
│ │ │ └── TodoList.js | |
│ │ └── Handler.js | |
│ └── Handler.js | |
└── main.js |
Why don't you put the styles in a seperate file then @irvinebroque?
Also it's bad practice to separate desktop and mobile stuff. Better find a responsive solution.
No hating here, just a friendly tipp :)
What about structure by feature, LIFT principle:
.
├── app.js
├── categories
│ ├── categoryActions.js
│ ├── categoryStore.js
│ ├── categoryUtils.js
│ └── components
│ ├── form.js
│ └── list.js
├── core
│ └── dispatcher.js
├── router.js
├── routes.js
No more than 3 levels
├── app
├── lib
├── components
├── handlers
├── home/
├── components/
├── ...
├── HomeView.jsx
├── styles.less
├── about
├── login
├── logout
├── index.js
├── routes.js
├── core
├── actions
├── stores
├── utils
├── config.js
├── dashboard
├── public
├── style
the app
directory is basically similar to the dashboard
directory. We're currently implementing this structure (having the app and dashboard in the same repo), and them have separate builds for them 😄
+1 to @kentcdodds
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is rad.
I've also been splitting up views and components that render differently based on device type into separate entry points:
This makes it much easier to generate separate bundles for desktop vs mobile, and a lot more clarity within views (fewer ternary and if else statements based on environment -- just put them in Handler.js). Handler ends up behaving more like a controller -- it fetches data, checks permissions, etc., while the components handle the UI rendering.
I've found this really helps when views start growing past a few hundred lines of code, which happens fast when you write css in js.