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

Order the Chaos: How to organize your react code

Order the Chaos: How to organize your react code

5 simple sample about how I organize my react code that may help you to improve your DX (Developer Experience) while your project scale

Matheus Monte

June 17, 2020
Tweet

More Decks by Matheus Monte

Other Decks in Programming

Transcript

  1. Who Am I? • Software engineer on Amazon Web Services

    (AWS) • Former Samsung and some startups. • Open source and community lover • Current Dubliner , but World Citizen • Travel, Live, Code and Repeat Matheus Monte
  2. Before Start, some details. - React is a Lib and

    not a framework. - It’s focused on V from MVC. - It’s flexibly to all uses
  3. • Move things in one direction • Create a timeline

    to envolve your code based on your project needs • You can choose a partner that fit in your team, this is just some “templates"
  4. Phase 1 • Still simple • Better to divide your

    code on section • On this context, component means visual and logic implementation (Data get, render and specific behaviour) • I can recommend this to PoC or small one-page websites Separate your components on diferente files
  5. Phase 2 • Once you get more files, you need

    to adequate your code structure • Create folder on the same domain that phase 1. • On this approach, you have more code separated by file together on same domain • Recommended to small projects with some data to handle. Separate your components on diferente files
  6. Phase 3 • Start separate your components, hooks, services, context

    by a high level folder structure • You have a better control on project parts and you can reuse better your code • Middle and High complex projects can scalable well on this structure Create Type Folders
  7. Phase 4 • Sometimes you have more than one view

    for same operation • You can create domains to separate and avoid unnecessary conflicts • You can add this to any another high level type folder Domains on Containers