Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: STATUS 422 "The given data was invalid" #23

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 16 additions & 12 deletions src/components/CheckoutForm/CustomTextField.jsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
import React from 'react';
import { useFormContext, Controller } from 'react-hook-form';
import { TextField, Grid } from '@material-ui/core';
import React from "react";
import { TextField, Grid } from "@material-ui/core";
import { useFormContext, Controller } from "react-hook-form";

function FormInput({ name, label, required }) {
const FormInput = ({ name, label, required }) => {
const { control } = useFormContext();
const isError = false;

return (
<Grid item xs={12} sm={6}>
<Controller
as={TextField}
name={name}
defaultValue=""
control={control}
label={label}
fullWidth
required={required}
error={isError}
name={name}
render={({ field }) => (
<TextField
{...field}
name={name}
label={label}
required={required}
fullWidth
/>
)}
/>
</Grid>
);
}
};

export default FormInput;