React Native Best Coding Practices

Hi there my friends on the internet, Today I will be sharing some of my best practices for writing maintainable code and saving time for the code review team;

Areas of improvement, Anyone with any suggestions please you can add comments, and will definitely add them to the list.

  1. Try using Formik and yup as much as possible for form implementations.

  2. Let's wrap a try/catch block for all API block codes for Exception Handling or make sure you handle the exceptions in the catch clause on the fetch API.

  3. When you use an async/Await syntax please always add a try and catch clause too, this is not added in the same areas.

  4. Remove deprecated & unnecessary commented code.

  5. Let's avoid Inline Styling, if possible let's keep the styles in a different file.

  6. Let's try not to repeat the code and follow the DRY principle.

  7. Let's eliminate the console logs added in the code while testing.

  8. To use any package, priority should be given to the react-native community

  9. If we are to add comments to clear ambiguity, let's keep it to a single-line comment.

  10. Use functional components with hooks as much as possible, its much cleaner and less code to write