Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Structuring a React.js App

Structuring a React.js App

This talked was presented on the 7 masters event.

Mauricio Soares

April 02, 2016
Tweet

More Decks by Mauricio Soares

Other Decks in Technology

Transcript

  1. Too many components ʮʒʒ actions ʮʒʒ components ʔ ʦʒʒ …

    30 files ʮʒʒ containers ʔ ʦʒʒ … 15 files ʮʒʒ index.js ʦʒʒ reducers
  2. ʮʒʒ actions ʮʒʒ index.js ʮʒʒ reducers ʮʒʒ screens ʦʒʒ shared

    shared is everything that can be used within your application (utils / components / routes / constants)
  3. ʮʒʒ actions ʮʒʒ index.js ʮʒʒ reducers ʮʒʒ screens ʦʒʒ shared

    Screens are components that have a great responsability on your application (usually containers)
  4. ʦʒʒ screens ʮʒʒ header ʔ ʦʒʒ index.js ʮʒʒ map ʔ

    ʦʒʒ index.js ʮʒʒ order ʔ ʦʒʒ index.js ʦʒʒ sidebar ʔ ʦʒʒ index.js
  5. ʦʒʒ screens ʦʒʒ order ʦʒʒ screens ʮʒʒ form ʔ ʦʒʒ

    index.js ʦʒʒ summary ʦʒʒ index.js Screens may have inner screens
  6. ʦʒʒ screens ʦʒʒ order ʮʒʒ screens ʔ ʮʒʒ form ʔ

    ʔ ʦʒʒ index.js ʔ ʦʒʒ summary ʔ ʦʒʒ index.js ʦʒʒ shared ʦʒʒ components ʦʒʒ select ʦʒʒ index.js Screens may have a shared folder
  7. If a file is shared among other root screens, it

    goes to the root shared folder
  8. ʦʒʒ screens ʦʒʒ order ʦʒʒ shared ʦʒʒ components ʦʒʒ select

    ʮʒʒ __tests__ ʦʒʒ index.js Tests files belongs to it’s context
  9. ʦʒʒ screens ʦʒʒ order ʦʒʒ shared ʦʒʒ components ʦʒʒ select

    ʮʒʒ __tests__ ʮʒʒ index.css ʦʒʒ index.js CSS files belongs to it’s context as well (thank God webpack!)