Hello, awesome devs! π We're all part of this fantastic journey, and it's crucial that we're on the same page to make our project shine. β¨ Before you submit your very first pull request, please take a moment to ensure your code meets the following guidelines.
1οΈβ£ ES6 Syntaxingπ : Utilize ES6 syntax in your JavaScript code for a cleaner and more modern style.
// π― Example: Using arrow function and template literal
const greet = name => `Hello, ${name}!`;
2οΈβ£ Commenting, Commenting and Commenting π¬: Your comments light the way for fellow devs! π Each function should have a brief comment explaining its purpose. If the code gets complicated, don't be afraid from adding many comments there as well.
// π― Example: Function to calculate the square of a number
const square = num => {
// Squaring operation
return num * num;
};
3οΈβ£ Tests for your functions using Jestπ§ͺ : Test your functions rigorously using Jest. Cover not only the "easy path" π but also those tricky edge cases πͺοΈ and failure scenarios π.[Hint: Could be easily done with π€ [ChatGPT](https://chat.openai.com π©βπ»π¨βπ»]
// π― Example: Jest test for square function
test('square of 2 should be 4', () => {
expect(square(2)).toBe(4);
});
#To run all tests before submission
npm test
4οΈβ£ Redux for State Management π Redux to the used for managing global states! π¦Έ Use Redux to share states across different components whenever needed.
// π― Example: Redux action to set username
export const setUsername = username => ({
type: 'SET_USERNAME',
payload: username,
});
// Redux reducer to manage username state π
const usernameReducer = (state = '', action) => {
switch (action.type) {
case 'SET_USERNAME':
return action.payload;
default:
return state;
}
};
5οΈβ£ Material UI for UI Components π¨ Material UI brings elegance and consistency to our UI. ποΈ Make sure to stick to Material UI guidelines for that sleek look and feel.
// π― Example: Using Material UI Button
import Button from '@material-ui/core/Button';
// Example of using Material UI Button
const MyButton = () => {
return (
<Button variant="contained" color="primary">
Click Me
</Button>
);
};
Happy coding, everyone! Let's make this project a masterpiece! π¨π