I have an onclick function
function showNextSteps(row){ const next_row = row+1 setSteps( function(prevState){ const obj = { ...prevState, row :{ ...prevState[row], "ShowButton":false }, next_row :{ ...prevState[row+1], "ShowButton":true, "ShowRow":true } } return (obj) } ) }
Here i want to use the index row
as the value of row
variable and same for next_row
But i see in my state there are new entries with row
and row_value
How to pass the variable value to index in this case
I tried
`${row}` and `${net_row}` as indexes
But i get unexpected token
https://stackoverflow.com/questions/67395046/reactjs-pass-variables-as-index-while-setting-state-variable May 05, 2021 at 12:03PM
没有评论:
发表评论