Skip to content

Commit

Permalink
fix(react): need className to consistently be a string
Browse files Browse the repository at this point in the history
  • Loading branch information
quantizor committed Sep 21, 2023
1 parent d39fab3 commit 18606bb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/gorgeous-falcons-happen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"twyx": patch
---

Fix `twyx/react` className fallback to empty string.
2 changes: 1 addition & 1 deletion react/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type DynamicElementProps<T extends React.ElementType> = Twyx.Props &
export const elementFactory = <T extends React.ElementType>(base: T) =>
React.forwardRef(
<Target extends React.ElementType>(
{ as, children, className, ...rest }: DynamicElementProps<Target>,
{ as, children, className = "", ...rest }: DynamicElementProps<Target>,
ref: React.Ref<Target>,
): React.ReactElement | null => {
return React.createElement(
Expand Down

0 comments on commit 18606bb

Please sign in to comment.