Our Best Practices for Writing React Components
Scott Domes

Excellent article, thanks for sharing. I have ‘borrowed’ a thing or two. A couple questions:

  1. When you use conditionals in JSX, we have been either using a function that returns the appropriate JSX or a variable defined above the return inside the render that handles the logic. Then you just pick them up in render with {this.func(p1, p2)} where p1 and p2 are used in the logic or {result} if you used the variable approach. It seems to clean up the render and make it easier to follow.
  2. I didn’t see any usage of inject from mobx-react and was curious there on your best practices (or non usage).
  3. I see you have state and mobx. Was curious if you could expand on that. I have kept everything pure and put the state back into my uiStore mobx observable, even for items like lists. It seems like you mix. Is there a reason to go either way or it does not matter much.
  4. How have your stores (mobx observables) grown as your app became bigger? Did you use one big class or object observable, multiple observables wrapped by one big class or object or something else? In addition, I have put a ‘redux’ style action layer in above my mobx observables, so that the stores are not changed directly from the components, since there can be other things like async that need to occur in that layer. Will you be digging into best practices on these issues?

Seems like 3–4 articles that could come out of this. It was not my intention, but would love to understand how your team is working with react/mobx.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.