在接下来的js中,我有多步骤的形式(再读)。 食堂活动属于布局所呼吁的一个部分,我希望能够添加一个pin子,使提交纽伦。 我怎么能够知道在上页上什么时候有人叫了。
排外。 -
export default function Layout({ children }: { children: React.ReactNode }) {
return (
<div>
<Sidebar />
<Provider>{children}</Provider>
</div>
);
}
供应商。
export default function Provider({ children }: FormProviderProps) {
const onMyFormSubmit = async (data: FormTypes) => {
await createStory(data);
}
return (
<FormProvider {...methods}>
{/* <form onSubmit={methods.handleSubmit(onSubmit)} className="flex w-full"> */}
<form onSubmit={methods.handleSubmit((data) => onMyFormSubmit(data))} className="flex w-full">
{children}
</form>
</FormProvider>
);
}
interface FormProviderProps {
children: React.ReactNode;
}
页: 1 -
export default function SummaryPage() {
return (
<div>
<FormWrapper heading="Finishing up" >
<div className="flex flex-col bg-alabaster rounded-lg px-4 lg:px-6 mt-6 w-full shrink-0">
<div className="flex items-center justify-between pt-4 pb-3 lg:pb-5">
<button
type="submit"
disabled={prop I need from onSubmit event}
className=".."
>
Submit story
</button>
<div className={prop I need from onSubmit event? undefined : hidden }>
<Spinner height="80" width="80" color="#713F12" />
</div>
</div>
</div>
</div>
);
}
I m new to Next and react, so would really appreciate guidance here. I ve looked at react context, but as far as I understand it, it doesn t seem dynamic (once an object has passed, it doesn t update)