Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/api/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 反应处理api参数未显示_Reactjs_Api_Parameters - Fatal编程技术网

Reactjs 反应处理api参数未显示

Reactjs 反应处理api参数未显示,reactjs,api,parameters,Reactjs,Api,Parameters,这是我的专栏。 我需要api中包含客户id的href。我目前正在使用reactTable,一切正常。但当我查看控制台内部时,只有参数没有被处理。 谁能告诉我少了什么 const columns = [ { Header: '', accessor: 'links[0].href', filterable: false, sortable: false, Cell: ({params}) => <Button color="seco

这是我的专栏。
我需要api中包含客户id的href。我目前正在使用reactTable,一切正常。但当我查看控制台内部时,只有参数没有被处理。 谁能告诉我少了什么

const columns = [
  {
    Header: '',
    accessor: 'links[0].href',
    filterable: false,
    sortable: false,
    Cell: ({params}) => <Button color="secondary" onClick={()=>deleteCustomer(params)}>Delete</Button>
  }
];

const deleteCustomer = (params) => {
  console.log(params)
};

const getCustomer = () => {
  fetch('https://customerrest.herokuapp.com/api/customers')
    .then(response => response.json())
    .then(data => setCustomer(data.content))
    .catch(err => console.error(err))
};

我不认为react表在Cell选项的回调中提供了“params”。尝试传递不带花括号的参数,然后选择所需的数据


Cell:(params)=>deleteCustomer(params)}>Delete

我不认为react表在Cell选项的回调中提供了“params”。尝试传递不带花括号的参数,然后选择所需的数据


Cell:(params)=>deleteCustomer(params)}>Delete

在onClick句柄函数中传递参数:

Cell: ({params}) => <Button color="secondary" onClick={(params)=>deleteCustomer(params)}>Delete</Button>
Cell:({params})=>deleteCustomer(params)}>Delete

在onClick句柄函数中传递参数:

Cell: ({params}) => <Button color="secondary" onClick={(params)=>deleteCustomer(params)}>Delete</Button>
Cell:({params})=>deleteCustomer(params)}>Delete