Closed azinit closed 3 years ago
https://www.smashingmagazine.com/2016/09/how-to-scale-react-applications/
Differentiate between containers and components.
Не всегда нужно, порой проще использовать хуки
Structure your files by feature.
Изучаем) Главный аргумент - "все лежит вместе, и легко масштабируется в дальнейшем"
While this works fine for examples, once you have hundreds or potentially thousands of components, development becomes very hard. To add a feature, you would have to search for the correct file in half a dozen different folders with thousands of files. This would quickly become tedious, and confidence in the code base would wane.
Use CSS modules and PostCSS Auto Reset.
Много минусов
Use redux-saga to:
Надо будет глянуть
to focus on the feature at hand, instead of having to worry about navigating the entire project.
It may seem reasonable to group similar objects together like this (controllers with controllers, components with components), however as the application grows this structure does not scale.
When you add and change features, you’ll start to notice that some groups of objects tend to change together. These objects group together to form a feature module. For example, in a todo app, when you change the reducers/todos.js file, it is likely that you will also change actions/todos.js and components/todos/*.js.
On the surface, organizing by feature may seem like an aesthetics concern, but as we will see in the next two rules, this way of structuring projects will help simplify your application code.
complexity as the complecting (or interleaving) of things.
The relevence of complexity to project structure is that when you place objects in close proximity to one another, the barrier to couple them lowers dramatically.
By artificially creating strict module boundaries, we can simplify our application code, and in turn increase the maintainability of our application. Instead of haphazardly reaching inside other modules, we should think about forming and maintaining contracts between them.
https://jaysoo.ca/2016/02/28/applying-code-organization-rules-to-concrete-redux-code/
todos/
/** react components */
components/
/** Actions & Action creators */
actions.js
actionTypes.js
/** consts for reducers */
constants.js
/** for managing public API of module */
index.js
/** things that are related to the module’s state */
model.js
/** module reducer */
reducer.js
/** memoized selectors (from `reselect`) */
selectors.js
index.js
rootReducer.js
Index and constants - The public API and constants.
Actions and action creators - Information that flow through the application.
Model - Types and utilities for the model.
Reducers - Updates module state.
Selectors - Queries module state.
https://www.pluralsight.com/guides/how-to-organize-your-react-+-redux-codebase
feature structure
Will be reopened after time and exp
Redux
App