Задать вопрос
@supkiler

Как можно исправить эту ошибку?

не пойму почему появляется такая ошибка ?67c1cf0b05b20450450796.png

ругается на options

import React from 'react'
import { FieldValues } from 'react-hook-form'

import ErrorMessageValidation from '../ErrorMessage/ErrorMessageValidation'

import { InputProps } from './CustomInputProps'
import styles from './CustomInputForm.module.scss'

const CustomInputForm = <T extends FieldValues>({
  register,
  label,
  errors,
  name,
  options,
  type,
  placeholder,
}: InputProps<T>) => {
  console.log(register)
  return (
    <div className={styles.wrapper}>
      {label ? (
        <label className={styles.label} htmlFor={name}>
          {label}
        </label>
      ) : null}
      {type === 'textarea' ? (
        <textarea
          className={`${styles.input} ${styles.textarea} ${errors && errors[name] ? styles.warning : ''}`}
          id={name}
          {...register(name, options)}
          placeholder={placeholder}
        />
      ) : (
        <input
          className={`${styles.input} ${errors && errors[name] ? styles.warning : ''}`}
          id={name}
          {...register(name, options)}
          placeholder={placeholder}
          type={type}
        />
      )}
      <ErrorMessageValidation errors={errors} name={name} />
    </div>
  )
}

export default CustomInputForm
  • Вопрос задан
  • 506 просмотров
Подписаться 1 Простой 1 комментарий
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы