我是 React 的新手,这些状态值会杀了我!我想要做的是添加input,select options每个select option都连接到它input,当我删除它们时,我想将它们一起删除,但这并没有发生。
当我删除任何一个时,只删除最后一行,select option并且不坚持使用相同的input.
这是我的代码:
import React, { Component } from 'react';
class SocialMedia extends Component {
constructor() {
super();
this.state = {
name: '',
SocialData: [],
socialArray: [
{
"id": 1,
"name": "Website",
"regex": "(https|http):\\/\\/(www\\.)*"
},
{
"id": 4,
"name": "Last.fm",
"regex": "(https|http):\\/\\/www\\.(lastfm\\.com|last\\.fm\\/|lastfm\\.ch).*"
},
{
"id": 5,
"name": "Facebook",
"regex": "https:\\/\\/www\\.facebook\\.com\\/.*"
},
{
"id": 6,
"name": "Twitter",
"regex": "(https|http):\\/\\/(twitter\\.com).*"
},
{
"id": 8,
"name": …Run Code Online (Sandbox Code Playgroud) reactjs ×1