Answer the question
In order to leave comments, you need to log in
How to define a value change function in an input managed bean?
Input Component:
import React from 'react'
import classes from "./AppInput.module.css"
interface Input {
placeholder: string,
type: string,
value: string,
// Тут, как я понял, нужно определить onChange, но как это должно выглядить?
// Аналогичный вопрос к определению keyDown
}
const AppInput: React.FC<Input> = ({placeholder, type, value, onChange}) => {
return (
<input className={classes.input} placeholder={placeholder} type={type} value={value} onChange={onchange}/>
)
}
export default AppInput
<AppInput type="text" placeholder="Какой-то текст." value={value} onChange={(e) => setValue(e.target.value)} onKeyDown={enterKey} />
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question