class Searchh extends React.Component {
refForm = React.createRef()
state = {
searchWord: '',
}
onChange = (e) => {
console.log(e.target.value)
this.setState({ searchWord: e.target.value })
}
addVal = (event) => {
event.preventDefault()
const { searchWord } = this.state
const { onSubmit } = this.props
onSubmit(searchWord)
}
activeForm = () => {
this.refForm.current.submit()
}
render() {
return (
<form onSubmit={this.addVal} ref={this.refForm}>
<Search
onChange={this.onChange}
placeholder="input search text"
enterButton="Search"
size="large"
onSearch={this.activeForm}
/>
{/* <input ref={this.refForm} style={{ display: "none" }} type="submit" value="dsa" /> */}
</form>
)
}
}
export default Searchh
class Searchh extends React.Component {
refForm = React.createRef()
state = {
searchWord: '',
}
onChange = (e) => {
console.log(e.target.value)
this.setState({ searchWord: e.target.value })
}
addVal = (event) => {
event.preventDefault()
const { searchWord } = this.state
const { onSubmit } = this.props
onSubmit(searchWord)
}
activeForm = () => {
this.refForm.current.submit()
}
render() {
return (
<form onSubmit={this.addVal}>
<Search
onChange={this.onChange}
placeholder="input search text"
enterButton="Search"
size="large"
onSearch={this.activeForm}
/>
<input ref={this.refForm} style={{ display: "none" }} type="submit" value="dsa" />
</form>
)
}
}
export default Searchh
activeForm = () => {
this.refForm.current.click()
}
render() {
return (
onChange={this.onChange}
placeholder="input search text"
enterButton="Search"
size="large"
onSearch={this.activeForm}
/>
)
}