Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/432.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/23.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
Javascript 在react-table-2的同一列中显示名字和姓氏_Javascript_Reactjs_React Bootstrap - Fatal编程技术网

Javascript 在react-table-2的同一列中显示名字和姓氏

Javascript 在react-table-2的同一列中显示名字和姓氏,javascript,reactjs,react-bootstrap,Javascript,Reactjs,React Bootstrap,我有一个API呈现一些用户数据、名字和姓氏等: users = [{ firstname: 'Peter', lastname: 'Pan' address: 'someAddress' }, firstname: 'Winnie', lastname: 'thePoo' address: 'someOtherAddress' }] 现在,我想在react-table-2的同一列中显示姓名,以便能够搜索名字和姓氏。 最好的方法是什么?我曾尝试通过“formatter”属

我有一个API呈现一些用户数据、名字和姓氏等:

users = [{
  firstname: 'Peter',
  lastname: 'Pan'
  address: 'someAddress'
},
  firstname: 'Winnie',
  lastname: 'thePoo'
  address: 'someOtherAddress'
}]
现在,我想在react-table-2的同一列中显示姓名,以便能够搜索名字和姓氏。 最好的方法是什么?我曾尝试通过“formatter”属性格式化数据,但在搜索时似乎效果不佳

有什么想法吗?我希望避免更改API
import React,{Component}来自'React';
常数数据=[
{
名字:“彼得”,
姓:“潘”,
地址:'someAddress'
},
{
名字:“温妮”,
姓:“thePoo”,
地址:“其他地址”
}
]
类TwoFielSameColumn扩展组件{
render(){
const finalData=data.map(项=>({
…项目,
全名:`${item.firstname}${item.lastname}`||“”,
}))
返回(
{finalData.map((q)=>{q.fullName})}
)
}
}
导出默认的TwoFielSameColumn