React hooks useState Array

前端 未结 5 1149
眼角桃花
眼角桃花 2021-01-30 07:39

I tried looking for resetting useState array values in here but could not find any references to array values.

Trying to change the drop down value from ini

5条回答
  •  孤城傲影
    2021-01-30 07:42

    use state is not always needed you can just simply do this

    let paymentList = [
        {"id":249,"txnid":"2","fname":"Rigoberto"}, {"id":249,"txnid":"33","fname":"manuel"},]
    

    then use your data in a map loop like this in my case it was just a table and im sure many of you are looking for the same. here is how you use it.

    { paymentList.map((payment, key) => ( )) }
    Transaction ID Name
    {payment.txnid} {payment.fname}

提交回复
热议问题