azinit / learn-frontend

Study examples during learning and exploring last frontend tools, libs, solutions.
2 stars 0 forks source link

Learn more: react-app structure #205

Closed azinit closed 3 years ago

azinit commented 3 years ago

Redux

App

azinit commented 3 years ago

WIP: Итоги

API

Store

Components

azinit commented 3 years ago

https://www.smashingmagazine.com/2016/09/how-to-scale-react-applications/

azinit commented 3 years ago

https://jaysoo.ca/2016/02/28/organizing-redux-application/

Rule #1: Organize by feature

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.

Rule #2: Create strict module boundaries

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.

Rule #3: Avoid circular dependencies

azinit commented 3 years ago

https://redux-toolkit.js.org/tutorials/advanced-tutorial https://jaysoo.ca/2016/02/28/organizing-redux-application/ https://jaysoo.ca/2016/02/28/applying-code-organization-rules-to-concrete-redux-code/ https://jaysoo.ca/2016/12/12/additional-guidelines-for-project-structure/

azinit commented 3 years ago

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.
azinit commented 3 years ago

https://ru.reactjs.org/docs/faq-structure.html

image

image

image

azinit commented 3 years ago

https://levelup.gitconnected.com/enterprise-size-react-application-directory-structure-90b0ebc60d59

azinit commented 3 years ago

@alexmngn

azinit commented 3 years ago

image

azinit commented 3 years ago

THEBEST

https://www.pluralsight.com/guides/how-to-organize-your-react-+-redux-codebase

feature structure

image

azinit commented 3 years ago

Total conslusions:

https://www.notion.so/Feature-Driven-Development-dfe306d664ae4780bcf999ccdd15e532

azinit commented 3 years ago

Will be reopened after time and exp