-
Notifications
You must be signed in to change notification settings - Fork 0
FrontEnd
asya982 edited this page Mar 20, 2023
·
19 revisions
- Using arrow functions for functional components;
- Props destructurization:
const Component = ({prop1, props2, prop3, ...props}) => {...};- We use Prettier to automatically format the code
{
"singleQuote": true,
"semi": false
}
- Syntax
- Use soft tabs set to 2 spaces.
- Indent lines with tabs instead of spaces.
- Use single quotes.
- Use trailing commas wherever possible, including function parameters and calls.
- Print spaces between brackets in object literals.
- Exclude parentheses around a sole arrow function parameter.
- Using self-closing tag for JSX-elements with no children.
- Don't use semicolons.
- Set off operators with spaces.
- Use braces with all multi-line blocks.
- Place 1 space before the opening parenthesis in control statements (if, while etc.).
- Place no space before the argument list in function calls and declarations.