Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6215

How to pass additional parameters to onChange function in React

$
0
0

So, I've faced this problem: I have this type of Element here, obviously there's event when changing the input, is it possible to pass params like this and access event as well? if so, how could I do it?

// this function accepts two other params index, stringValuefunction onChange(index ,stringValue) {    console.log(event.target.value);    console.log("index?: " + index +" and value" + stringValue)}//this input is in Child Componentconst index = 69;const someRandomValue='iamstring';<input defaultValue={name} onChange={onChange(index,iamstring)} />

Viewing all articles
Browse latest Browse all 6215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>