Best practices? I dunno. Current good practices, based on combined experience of a bunch Facebook and Instagram engineers (I work for Facebook)? Yeah. Best practices of today could be the anti-patterns of tomorrow. We can only try our best given the experience and knowledge we have so far. I'd avoid dogma
All the code for the book is on github, check this out as an example of what you can expect.
Some good practices include:
small simple components that do one thing
stateless components = better
one component per file, file name = component name
every component is a JS module
one module exports one thing
module dependencies (require or import) defined up top in one place
one corresponding CSS file per JS component, named after it, both file name and class name prefix. E.g. .Dialog .DialogBody defined in Dialog.css. Even though the CSS discussion is a little beyond the scope of the book
Also, which version of React are you using in the book?
The latest version at the time of writing was v15.0.1
Stoyan Stefanov wrote:The latest version at the time of writing was v15.0.1
Looks like the current version is v15.3.0 so the book is amazingly up-to-date (ask me about trying to keep up with changes in jQuery UI while writing the first edition of jQuery in Action! Or better yet, don't!)
How much churn is there in React? Does it update frequently? Is there a commitment to backwards compatibility between versions?
And, version 15? I assume that updates in the major version number do not indicate complete rewrites? (I'm looking at you Angular 2!)