-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ct): solid pass children when they are defined (#29648)
- Loading branch information
Showing
7 changed files
with
35 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 4 additions & 13 deletions
17
tests/components/ct-react-vite/src/components/CheckChildrenProp.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,7 @@ | ||
type DefaultChildrenProps = { | ||
children?: any; | ||
} | ||
import type { PropsWithChildren } from 'react'; | ||
|
||
type DefaultChildrenProps = PropsWithChildren<{}>; | ||
|
||
export default function CheckChildrenProp(props: DefaultChildrenProps) { | ||
const content = 'children' in props ? props.children : 'No Children'; | ||
return <div> | ||
<h1>Welcome!</h1> | ||
<main> | ||
{content} | ||
</main> | ||
<footer> | ||
Thanks for visiting. | ||
</footer> | ||
</div> | ||
return <>{'children' in props ? props.children : 'No Children'}</> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 4 additions & 13 deletions
17
tests/components/ct-react17/src/components/CheckChildrenProp.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,7 @@ | ||
type DefaultChildrenProps = { | ||
children?: any; | ||
} | ||
import type { PropsWithChildren } from 'react'; | ||
|
||
type DefaultChildrenProps = PropsWithChildren<{}>; | ||
|
||
export default function CheckChildrenProp(props: DefaultChildrenProps) { | ||
const content = 'children' in props ? props.children : 'No Children'; | ||
return <div> | ||
<h1>Welcome!</h1> | ||
<main> | ||
{content} | ||
</main> | ||
<footer> | ||
Thanks for visiting. | ||
</footer> | ||
</div> | ||
return <>{'children' in props ? props.children : 'No Children'}</> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
tests/components/ct-solid/src/components/CheckChildrenProp.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { type ParentProps } from 'solid-js'; | ||
|
||
type DefaultChildrenProps = ParentProps<{}>; | ||
|
||
export default function CheckChildrenProp(props: DefaultChildrenProps) { | ||
return <>{'children' in props ? props.children : 'No Children'}</> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters