Hello!
I've updated from [email protected] to [email protected] and I got some new specific errors. I got unexpected react/no-unused-prop-types error on 5 and 6 lines in the next code listing.
// @flow
import React from 'react';
export type ChildComponentProps = {
value: string,
name: string
};
export const ParentComponent = ({arrayOfSmth}: Object) => {
return (
<div>
{arrayOfSmth.map(({value, name}: ChildComponentProps) => {
return (
<span>
{name ? value : <Text>{name}</Text>}
</span>
);
})}
</div>
);
};
5:12 error 'value' PropType is defined but prop is never used react/no-unused-prop-types
6:11 error 'name' PropType is defined but prop is never used react/no-unused-prop-types
Is it expected behavior for my case?
That鈥檚 very strange indeed, seems like a bug.
Also, have the same issue.
I have a very similar issue:
class SomeComponent extends PureComponent<Props> {
method({ param }: { param: boolean }) {
}
render() {
return null;
}
}
'param' PropType is defined but prop is never used react/no-unused-prop-types
Workaround: the issue disappears if I don't destructure the parameters method(dontDestructure: { param: boolean }) {
I think you mean destructure; spread is three dots.
You're right, I totally meant destructure. I've edited my message.
Have the same issue here:
const Wrapper = featureToggle
? ({ children }: { children: Node }) => (
<FeatureToggledComponent
featureToggle={featureToggle}
defaultValue
>
{children}
</FeatureToggledComponent>
)
: React.Fragment;
75:54 error 'children' PropType is defined but prop is never used react/no-unused-prop-types
Most helpful comment
I have a very similar issue:
Workaround: the issue disappears if I don't destructure the parameters
method(dontDestructure: { param: boolean }) {