score:17

Accepted answer

Try this:

<textarea rows={3} 
  className='form-control' 
  placeholder='Enter About your description'/>

score:0

The rows attribute requires a number, not a string. Also you will need to update the value of the textarea like this:

<textarea 
  name="description"
  value={formValues.description}
  rows={3} 
  className='form-control' 
  placeholder='Enter About your description'
  onChange={evt=>handleInputChange(evt)}/>

The handleInputChange function below:

// You can define an interface to type the formValues object like this
interface formValuesInterface {
    description: string
}

// Keep the description value in the state like this
const [formValues, setFormValues] = React.useState<formValuesInterface>({description: ''})

const handleInputChange = (evt: React.ChangeEvent<HTMLInputElement>)=> {
    const { name, type } = evt.target
    const value = target.type === 'checkbox' ? target.checked : target.value;
    setFormValues({ ...formValues, [name]: value })
}

Check out React forms for more information


Related Query

More Query from same tag