<textarea rows='3'
className='form-control'
placeholder='Enter About your description'/>
Try this:
<textarea rows={3}
className='form-control'
placeholder='Enter About your description'/>
the row
property 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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.