const TextareaExample = () => {
const ref = React.useRef()
const handleSubmit = event => {
event.preventDefault()
if (!ref.current.value) {
alert(`Enter a value into the Textarea and press submit`)
return
}
alert(`Current Textarea value: ${ref.current.value}`)
}
return (
<form onSubmit={handleSubmit}>
<Textarea
cols={40}
rows={8}
ref={ref}
defaultValue="Set the initial state in uncontrolled mode using the defaultValue prop"
/>
<br />
<Button type="submit">Submit</Button>
</form>
)
}
render(<TextareaExample />)