Skip to content

Module Internals

MeyerBuaharon edited this page Dec 13, 2019 · 1 revision
src/slides/
  index.js
  components/
    SlideList
      SlideList.js
      SlideList.scss
      SlideItem.js
      SlideItem.scss
      index.js
   SldeContent.js
   SldeContent.scss
  store/
    actions.js
    reducer/
      reducerA.js
      reducerB.js
      index.js
  services/
  utils/

Business Logic (Store, Services)

The store directory is the redux directory. This is where you write most of the application logic, separated into action creators and reducers.

Components can access business logic only via action creators. They may not call services or access the store

The module's root index.js usually exposes the root reducer of a module, such that it can be composed into the application's root reducer. In addition to this, any action creators that are callable from outside should also be exported by this file.

export Slides from './components/Slides'

export * as slideActions from './store/actions'

export slidesReducer from './store/reducer'

Utils

Utility functions and (other artifacts) are put into the utils directory. Most such functionality is usually generic and is not specific to a domain area, thus most utilities find their way to the shared module.

Note: a generic ajax libray wrapper is usually be considered a utility. The domain specific api calls made using it, will usually be encapsulated in a service.

Clone this wiki locally