Skip to content

ReactJS Code Review Checklist

Checklist

Sr No.Check
1Check if common services can be made
2Create a common component if it can be reused in an app. Create single responsibility components
3Create a separate folder for routes for a specific page and import all components and map them with the routes.
4State and UI should be maintained separately.
5The project should have a Readme file with instructions how to run locally and other useful info
6Minimize logic in the render method. Logic should be in helper methods, container components or in Redux actions (if used)
7Use functional components for components that don’t use state
8Make sure you don’t edit props within a component
9Use code formatting such as beautify and prettier for indenting the codes
10Remove unwanted variables and method that are not in use.
11Remove unwanted packages that are not in use from package.json
12Every useEffect and function should have proper commenting
13There should be consistency in the import statement used in the files
14Need to have baseUrl set for import
15Avoid using var, and promote use of let and const.
16There should be 0 warnings while compiling the code
17Make sure that sensitive data are saved on .env files and are used from that on projects.
18Avoid unnecessary use of redux
19Merge common styling by providing the common classnames
20Prevent unwanted re-rendering of components
21Create utils for performing common action through the project
22Use constant file in a component to get the static content
23Use arrow functions to create methods instead of binding in constructors.
24While using keys for dynamic lists check if keys are unique index should be fine if the list items will not change order. Preferred way is to use primary keys generated from db.
25Try avoiding multiple setState in a single function and be mindful of the asynchronous nature of setStates.
26When changing state in setState based on previous state value use previous state.
27Sync and npm-check to automate the task of identifying insecure and outdated components.
28Use Redux for global state management
29Make sure to use functional components for components that don’t use state
30Don’t use mixins, prefer HOC and composition
31Avoid using inline styles, rather use themes or styled components
32Avoid to useEffect without dependencies - Can loop infinitely
33Use Memoization to reduce load on App / Server
34Apply Lazy-Loading where its required to optimize bundle load
35Avoid direct DOM access
36Avoid JSON injection attacks
37All the paths private information should be a part of env file to avoid exposing
38Minimize logic in the render method. Logic should be in helper methods, container components or in Redux actions (if used)