Win a copy of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

React: Up & Running: Best practices?

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Stoyan, hope you're having a nice day. I have a question about your new book, about the way you teach to create SPA apps.

Do you use to show best practices during the book, like how to structure your project files, considerations when creating components and so on? Also, which version of React are you using in the book?
 
author
Posts: 85
5
PHP
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
     
    Oscar Calderon
    Ranch Hand
    Posts: 36
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Cool! Thanks Stoyan, can't wait for your book!!
     
    Sheriff
    Posts: 67592
    173
    Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    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!)
     
    Stoyan Stefanov
    author
    Posts: 85
    5
    PHP
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Bear Bibeault wrote:Does it update frequently? Is there a commitment to backwards compatibility between versions?



    Yes and yes. Deprecated APIs bring a console warning for a few versions before they disappear completely.

    And, version 15?



    15 was sorta major-ish and I hope there's nothing major coming in foreseeable future

    There was a versioning scheme change so v15.0.0. was the version after v0.14.4. which was kinda funny.
     
    Bear Bibeault
    Sheriff
    Posts: 67592
    173
    Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Stoyan Stefanov wrote:There was a versioning scheme change so v15.0.0. was the version after v0.14.4. which was kinda funny.



    Ah, yes, changing the version numbering canoe mid-stream.

     
    You showed up just in time for the waffles! And this tiny ad:
    Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    reply
      Bookmark Topic Watch Topic
    • New Topic