Guidelines
We are a democracy but the code that does not respect the guidelines could be rejected.
Note: we assume you are using Visual Studio Code
Naming
all
.js
filenames must be incamelCase
all class name must me in
PascalCase
variable and function names must be written as
camelCase
constants must be written in
UPPERCASE
Component Naming: Use the filename as the component name. For example,
ReservationCard.jsx
should have a reference name ofReservationCard
. However, for root components of a directory, useindex.jsx
as the filename and use the directory name as the component name:Props Naming: Avoid using DOM component prop names for different purposes.
Why? People expect props like
style
andclassName
to mean one specific thing. Varying this API for a subset of your app makes the code less readable and less maintainable, and may cause bugs.Always use camelCase for prop names, or PascalCase if the prop value is a React component.
Format & Style
your code must be well formatted
Alignment
Quotes
Why? Regular HTML attributes also typically use double quotes instead of single, so JSX attributes mirror this convention.
Spacing
React
Always use JSX syntax.
Do not use
React.createElement
Use
Hooks
. Hooks are a new addition in React 16.8. They let you use state and other React features without writing a class.
Last updated