Giter Club home page Giter Club logo

chekhov-react-seed's Introduction

App

To start the dev server:

  • Install dependencies with yarn install
  • Start server with yarn start

Now you can visit localhost:3000 from your browser.

Project folder structure

  • Elements - UI kit for application containing all the buttons, inputs, text styles etc

  • Layouts - Layouts containing common elements for different user states e.g. authorized non authorized layout

  • Pages - Top level page components

  • Redux - Folder containing modules for state each module contain:

    • ModuleName - Folder named by reducer e.g User

      • index.js - entry file where all exports take place
      • UserReducer.js - reducer with redux-actions & Immutable.js
        import { handleActions, createAction } from 'redux-actions'
        import Immutable from 'seamless-immutable'
        
        // --- 
        // CONSTANTS
        // ---
        export const SET_ACTIVE_ORDER = 'trade/SET_ACTIVE_ORDER'
        
        // ---
        // ACTION CREATORS
        // ---
        
        export const setActiveOrder = createAction(SET_ACTIVE_ORDER)
        
        // ---
        // INITIAL STATE
        // ---
        
        const initialState = Immutable({
          activeOrder: null
        })
        
        // ---
        // REDUCER
        // ---
        
        export default handleActions(
          {
            [SET_ACTIVE_ORDER]: (state, action) =>
              Immutable.merge(state, { activeOrder: action.payload })
          },
          initialState
        )

      This structure is strict

      • UserSelectors.js - selectors for redux using all mapStateToProps goes with selectors

      reactjs/reselect

      • UserSagas.js - sagas for sideeffects

      redux-saga/redux-saga

  • modules - Folder containing all the reusable container and components each folder has it's own module name e.g. User

    • User - folder containing user's related components and containers, which are not screens
      • components - folder containing all components
      • containers - folder containing all the containers
  • Utils - utils folder

Easy to follow practices:

  • Components do not have mapState functions
  • You can't add component to the Elements folder without a subfolder
    • Elements → Lists → DefaultList.js (GOOD)
    • Elements → SomeRandomComponent.js (BAD)
  • Containers do not have template, only import from component file
  • Each component extends from PureComponent
  • Unit tests are placed in the same folder as tested file
  • PropTypes are required for each component

chekhov-react-seed's People

Contributors

d-manevich avatar ilyaviache avatar satanworker avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.