I love Air Bnb - not only is their app amazing (I love looking at the unique hosting spots like this home suspended from a cliff overhang in Kentucky), but I also love their style guide and keep it handy every time I write code. I would be fair to say that Air BnB would be my dream job.
I thought it would be fun to review each of their style guide rules for React/JSX each day. It's a good review to do and also allows one to meditate upon it's meaning. I find this as a useful way to really nail down good practices.
Day 1: Basic Rules
Here are the basic rules laid out by Air BnB
- 
Include only one React component per file. Except for Stateless, or Pure, Components - they allow multiple per file.
- Set eslint: 
react/no-multi-comp 
 - Set eslint: 
 Always use JSX syntax.
Don't use
React.createElementunless you're initializing an app from a file that is not JSX.react/forbid-prop-typeswill allowarraysandobjectsonly if it is explicitly noted what they contain, usingarrayOf,objectOf, orshape.
That's all for the basic rules! See you tomorrow
So that's not too bad right? I will meditate upon those and think about what that means for my code.
"Oooohhhhhhhhhmmmmmmmmmmmmm..."
"Oooohhhhhhhhhmmmmmmmmmmmmm..."
"Oooohhhhhhhhhmmmmmmmmmmmmm..."
............... 
              
    
Top comments (0)