import Card from "../../components/Card"
import Container from "../../components/Container"
import { z } from "zod"
import { TextField } from "../../components/TextField"
import { createTsForm } from "@ts-react/form"
const mapping = [[z.string(), TextField]] as const
const MyForm = createTsForm(mapping)
export default function SearchPage() {
const FindOrderSchema = z.object({
email: z.string().email("Enter a real email please."),
orderNumber: z.string(),
})
function onSubmit(data: z.infer<typeof FindOrderSchema>) {
// gets typesafe data when form is submitted
}
return (
<>
<Container>
<Card
title="Exchange or return your order"
subtitle="Enter your details to find your order"
>
<MyForm
schema={FindOrderSchema}
onSubmit={onSubmit}
renderAfter={() => <button type="submit">Submit</button>}
/>
</Card>
</Container>
</>
)
}
Getting this error though trying to open the page.
Not sure why. My TextField import looks like this:
My code:
Getting this error though trying to open the page.
Not sure why. My TextField import looks like this: