Skip to content

Instantly share code, notes, and snippets.

@HashirHussain
Created June 1, 2021 08:33
Show Gist options
  • Save HashirHussain/2ed0143a5ad258c1571102b2f208a468 to your computer and use it in GitHub Desktop.
Save HashirHussain/2ed0143a5ad258c1571102b2f208a468 to your computer and use it in GitHub Desktop.
React standards checklist
1. `key` should be stable, predictable and unique amongst the list items and their children.
2. Split Presentational and container components.
3. Presentational components only hold the markup.
4. Always make the presentational component a functional component.
5. A container holds the state or other business conditions.
6. Use `React.PureComponent` for Container and `React.memo` for Presentational component.
7. Use ternary operator as little as possible in both components and the render method.
8. Avoid using context in the application.
9. Always define default props.
10. Avoid using nested state.
11. Avoid direct use of [] or {} for coparision. use `const defualt = []` instead.
12. If several components reflect the same changing data, lift the shared state to a common ancestor.
13. bind functions in the constructor.
14. Render list in a dedicated component.
15. `props` must be readonly.
16. Consider using `selectors` while dealing with redux.
17. Split big reducer into a small one.
18. Make thinner reducer hierarchy.
19. Create common helper functions for repeated conditions.
20. Make common presentation components for repeated JSX.
21. Avoid passing closures to sub-components.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment