I am getting those errors but I have no idea how to fix them. This is how I define and use the property in question:
type State = {
isLoading: boolean // <-- 'isLoading' PropType is defined but prop is never used
};
type Props = {};
export default class MyComponent extends Component<State, Props> {
constructor(props) {
super(props);
this.state = { isLoading: true };
}
render() {
const {isLoading } = this.state; // <-- property `isLoading` is missing in `Props` [1].Flow(InferError)
index.js(25, 52): [1] `Props`
if (isLoading)
return (
<Container>
<Spinner color="blue" />
</Container>
);
}
}
So there are defined and they are used (when I am destructuring). I also do not understand the Flow error, but they are obviously related.
You reversed the order of
PropsandStatetype parameters that you passed to theComponent, so Flow thinks props isStateand state isProps. That line should look like this, withPropsfirst followed byState:Check out the Flow docs on React components for more.