Skip to content

Instantly share code, notes, and snippets.

@dioxmio
Created October 15, 2022 16:09
Show Gist options
  • Save dioxmio/e28c9da030248e93035ea2f120c3213a to your computer and use it in GitHub Desktop.
Save dioxmio/e28c9da030248e93035ea2f120c3213a to your computer and use it in GitHub Desktop.
// ✅ Creating multiple composable Components
function Dialog(props: DialogProps) {
...
}
function DialogTitle(props: DialogTitleProps) {
...
}
function DialogContent(props: DialogTitleProps) {
...
}
function DialogActions(props: DialogActionsProps) {
...
}
type AvengerProps = {
description: string;
name: string;
}
// ✅ Combining declarative components to a complex layout
function ShowAvenger({description, name}: AvengerProps) {
return (
<Dialog>
<DialogTitle>
...
</DialogTitle>
<DialogContent>
...
</DialogContent>
<DialogActions>
...
</DialogActions>
</Dialog>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment