-
Notifications
You must be signed in to change notification settings - Fork 0
Code Formatting Guide
Diego Mejía edited this page Apr 19, 2022
·
1 revision
Use camelCase, like so:
let testingVariable = 0;
Environment variables should be all uppercase SNAKECASE, as well as starting with "REACT_APP_" so that REACT is able to detect them, like so:
REACT_APP_TESTING_VARIABLE = "secret_key_123";
(Note that if an environment variable is either modified or created while running a development server, said server should be restarted to read those changes)
For the following functions, use camelCase for their definition.
const normalFunction = () => {
console.log("hello world");
}
async function helloAsync() {
await console.log("hello world");
}
function helloComponent ({ name }) {
/*
A React component should be structured like this:
- React Hook declaration
- Variable declaration
- Normal functions
- Async functions
*/
return (
<p>Hello World { name }!</p>
)
}
Try to stick to the following folder schema: