K
K
kirillleogky2020-10-02 10:52:23
JavaScript
kirillleogky, 2020-10-02 10:52:23

How to add an input value to the handler function argument?

There is an input:

<input onChange={this.getChangeBonusType(здесь передать значение этого инпута)}/>


How can I pass an input value to a function argument?
NOT USING
<input onChange={(event) => this.getChangeBonusType(event.target.value)}/>
!!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
J
JavaDev, 2020-10-02
@kirillleogky

getChangeBonusType = (argument) => () => {
  console.log(argument);
}

D
Demian Smith, 2020-10-02
@search

Like this

//...
getChangeBonusTypeHandler = (event) => this.getChangeBonusType(event.target.value);
//...
render() {
  return <input onChange={this.getChangeBonusTypeHandler}/>
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question