I am facing a problem with importation because I've created a div input as a component to use in other pages. In this case, sign up page:
<Input
placeholder="Email"
name="email"
{...register("email")}
/>
But, this input is not receiving this register as a component.
import { InputContainer } from "./styles"
function Input({placeholder, register, name, error, ...rest}) {
return (
<InputContainer isErrored={!!error}>
<input
placeholder={placeholder}
{...register(name)}
{...rest} />
</InputContainer>
)
}
export default Input
I've received that register is not a function, but I had declared it before, on signup page too:
const {
register,
handleSubmit,
formState: { errors },
} = useForm({
resolver:yupResolver(schema)
})