import React from 'react';
import { useForm } from 'react-hook-form';
function FormHook( props ) {
const { register, handleSubmit} = useForm();
const onSubmit = data => console.log(data);
console.log(errors);
return (
<div className={props.className}>
<form onSubmit={handleSubmit(onSubmit)}>
<input type="text" placeholder="First name" {...register("First name", {required: true, maxLength: 80})} />
<input type="text" placeholder="Last name" {...register("Last name", {required: true, maxLength: 100})} />
<input type="text" placeholder="Email" {...register("Email", {required: true, pattern: /^\S+@\S+$/i})} />
<input type="tel" placeholder="Mobile number" {...register("Mobile number", {required: true, minLength: 6, maxLength: 12})} />
<input type="text" placeholder="Company" {...register("Company", {required: true})} />
<label>Ecommerce Platform</label>
<select {...register("Ecommerce Platform", { required: true })}>
<option value="Shopify">Shopify</option>
<option value=" Woocommerce"> Woocommerce</option>
<option value=" BigCommerce"> BigCommerce</option>
<option value=" Square"> Square</option>
<option value=" Magento"> Magento</option>
<option value=" PrestaShop"> PrestaShop</option>
<option value=" Other"> Other</option>
<option value=" Custom"> Custom</option>
</select>
<input type="url" placeholder="Website" {...register("Website", {required: true})} />
<input type="submit" />
</form>
</div>
);
}
export default FormHook;
Oh, I think you need to add a export
before function FormHook
(like export function FormHook( props) {
)
Because you’re importing it like import { FormHook } from "..."
well thats a brand new way it failed now lol
AND TOUCHDOWN
i cant wait to go back to python