Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Is it necessary to validate react native props?

I am creating a react native app with expo. When I run ESlint, I receive over 100 errors concerning react/prop-types. Most of the errors look like this:

18:37  error  'route' is missing in props validation       react/prop-types

I understand that I can validate all of my proptypes with code that looks like this:

import PropTypes from "prop-types";

...

App.propTypes = {
  route: PropTypes.object.isRequired,
};

However my app works fine without prop validation (at least, it seems to work fine). Is it necessary to validate all of my props, or can I simply silence the ESlint error without harming my app?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

This validation is used to enhance the development process and bug detection.

It doesn’t make the app safer directly.

You can disable this option entirely if you don’t like it.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading