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?
2
Answers
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.
Typing is really helpful to understand your code later on and to avoid bugs, but is not required. I personally prefer using Typescript in combination with React. Giving components an Interface makes propTypes obsolete.