Passing fields into components by spreading shows them as unused by the relay/unused-fields, while passing them one by one does not cause any issues.
type Props = {
data: ParentComponent_data;
};
const ParentComponent: FC<Props> = ({ data }) => {
const { title, ...rest } = data;
return <SharedComponent title={title} {...rest} />;
}
export default createFragmentContainer(ParentComponent, {
data: graphql`
fragment ParentComponent_data on Data {
name # <- Triggers a warning about not being used!
title
}
`,
});
Passing fields into components by spreading shows them as unused by the
relay/unused-fields, while passing them one by one does not cause any issues.