I m New to NextJS and response and I m seeking to knowledge composition.
I have a client component called Form.jsx
like
export default function FormHome() {
... tons of client side javascript function ...
const [open, setOpen] = React.useState(false);
function onSubmit(data: z.infer<typeof FormSchema>) {
startTransition(async () => {
... other code ...
setOpen(true);
});
});
}
if(isDesktop) {
return (
<Form {...form}>
... a very long block of javascript that interacts with the function above...
<Dialog open={open} onOpenChange={setOpen}>
... some other code ...
</Dialog>
</Form>
);
}
return (
<Form {...form}>
... a very long block of javascript that interacts with the function above...
<Drawer open={open} onOpenChange={setOpen}>
... some other code ...
</Drawer>
<AlertDialog open={openAlert} onOpenChange={setOpenAlert}>
</AlertDialog>
</Form>
);
}
之后,我有<代码>网页.tsx。 公正
export default function Home() {
return <Form />;
}
在同一<代码>Form.jsx的客户部分中,有某种方式可以确定以下各项:<Drawer>
,<Dialog>
,等等,但通过这些变量(例如,我需要通过{>><>>>>>>>>>>>和
Open}
)。