for example, there is a string like: watch? Minute course, send? Integral
I need to change the ?
in the string to the input
input box and bind the change
event to the input box.
?
in string is not fixed
for example, there is a string like: watch? Minute course, send? Integral
I need to change the ?
in the string to the input
input box and bind the change
event to the input box.
?
in string is not fixed
convert the string to an array first, and then loop
var items = str.split('?').reduce((state, item, index) => {
if (index) {
state.push(<input onChange={changeHandler} />)
}
state.push(item)
return state
}, [])