Our Best Practices for Writing React Components
Scott Domes

I agree with pretty much of all this, except assigning the props to a variable and then assigning that to propTypes below your stateless component. Since you are using function syntax, and functions are hoisted, you can assign propTypes directly to the constructor above the constructor and save a line of code.


Foo.propTypes = {}

function Foo () {}


It’s one of the strengths of JavaScript, might as well use it.

One clap, two clap, three clap, forty?

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