-
Notifications
You must be signed in to change notification settings - Fork 1
Patterns
Florian Mettetal edited this page Jul 29, 2018
·
2 revisions
- routes are layouts that import components
- components import modules, whether first or third party
- first party modules should be treated like and expected to behave like third party modules
The new module is placed in a "modules" directory because the end-goal is to refactor it into a standalone ts-react-module which can then be installed via npm from a private registry.
This means that there is some duplication between the new module's file structure and that of the parent-app.
.
├── helpers/ # dependencies that need to be included in the refactor, could violate DRY
├── types/ # dependencies that need to be included in the refactor, could violate DRY
├── theme.scss # dependencies that need to be included in the refactor, could violate DRY
Additionally, a module shouldn't import anything from outside of its directory, if it does - that thing that should be copied into the module directory and imported locally. Better yet, if its a common enough piece of code, move it into a new module folder and follow this abstraction pattern.