在React中以setState传递参数

时间:2018-07-26 06:35:47

标签: javascript reactjs

  handleUpdateRingers(index, event) {

    this.setState({
      items: update(this.state.items, {0: {ringerNumbers: {$set: event.target.value}}})
    }, () => this.updateTotals())

如何在setState中删除0的硬编码并使用索引来驱动它?

1 个答案:

答案 0 :(得分:1)

<body> <?php $i=1; foreach($data as $row) { ?> <form method="post" enctype="multipart/form-data"> <div class="container"> <h5 style="color:#ff1a1a">Select Section</h5> <?php $array = array('Creative'=>'Creative','Photography'=>'Photography','Development'=>'Development'); echo form_multiselect('type[]',$array,$row->type); ?> <span class="text-danger"><?php echo form_error("type");?></span><br><br> <br><input type="submit" name="update" class="btn btn-success" value="Update Records"/> </div> </form> <?php } ?> </body> 用作index的大括号括起来:

Object