Description
Hello all!
I am making a Formik form and ESLint was complaining about some props missing validation. Then, I added propTypes and defaults and I got the error "PropType is defined but prop is never used".
I believe this error is due to the fact that when I place MyComponent.propTypes blabla I was assigning props to my functional components. However, ESLint complains about the props passed to the render prop function. An example of such props are errors and touched from the function ValidationSchemaExample on https://jaredpalmer.com/formik/docs/guides/validation
In my personal code I had something like this:
const renderResetPasswordRequestForm = ({ errors, touched, handleSubmit } ) => {
return (
<form onSubmit={handleSubmit}>
</form>
);
};
Which was triggering the error, however, with the below code it does not happen:
const renderResetPasswordRequestForm = formikProps => {
const { errors, touched, handleSubmit } = formikProps;
return (
<form onSubmit={handleSubmit}>
</form>
);
};
So the key question:
Anyone understand why if I destructure the parameters it complains and if I do so in the body of the function ESLint does not complain?
Thank you in advance and regards.