Skip to content

Commit

Permalink
avoid Component.defaultProps for icon components (#3602)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasheyenbrock committed May 14, 2024
1 parent e3ca774 commit 03ab3a6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/nervous-numbers-push.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@graphiql/react': patch
---

Avoid using deprecated Component.defaultProps for icon titles
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ function generateIcon(
.trimStart()
.toLowerCase() + ' icon',
): FC<ComponentProps<'svg'>> {
RawComponent.defaultProps = { title };
return RawComponent;
function IconComponent(props: ComponentProps<'svg'>) {
return <RawComponent title={title} {...props} />;
}
IconComponent.displayName = RawComponent.name;
return IconComponent;
}

0 comments on commit 03ab3a6

Please sign in to comment.