I've seen a bunch of different outlines for how to structure React applications and frankly; lots of them suck.
After lots of experimentation I thought up how LRS is outlined here and wanted to document it for my new team.
Would love to hear your thoughts on it
After lots of experimentation I thought up how LRS is outlined here and wanted to document it for my new team.
Would love to hear your thoughts on it
Reposted from
Playful Programming
Without a solid foundation, projects can require a lot of refactoring, and questions may arise as to how to organize and test your code for maximum efficiency.
With LRS, itβs easy to manage all of the components that you need.
With LRS, itβs easy to manage all of the components that you need.
Comments
How do you disambiguate between a page `header.tsx` component and a `/components/select/dialog/header.tsx` (just an example)?
1/2
Do you call one `Header` and the other `SelectDialogHeader`?
Do you call one `Header` and the other one `_Header` (_ is for "this is private within this subdirectory)?
- `Select`
- `SelectDialog`
- `SelectDialogHeader`
All within:
- components/select
You'd have:
- select/select.tsx
- select/select-dialog.tsx
Et al. HTH!
Anyway, thanks π
QQ: you remind us of the distinction between smart/dumb components in the beginning but I don't see where you then reference it in the structure (e.g. different folders for those). Intentional?
Oh and another QQ: what's the difference between button/index.tsx and button/button.tsx?
- components are purely dumb components, no state
- .ui files are also dumb
The only smart comps are in `.view` files in `views`