我在使用react-csv时遇到数据问题,我从以下位置返回了数据 api 格式如下。
我想解析标题,数据以用于 反应 csv?
id,first_name,last_name,email,gender,ip_address
1,Sibby,Gehrels,[email protected],Female,202.163.188.135
2,Karin,Mulran,[email protected],Female,160.131.170.201
3,Silvan,Ablett,[email protected],Male,208.242.3.221
const header = ["id", "first_name", "last_name", "email", "gender", "ip_address"]
const data = [
{"1","Sibby","Gehrels","[email protected]","Female","202.163.188.135"},
{"1","Sibby","Gehrels","[email protected]","Female","202.163.188.135"}
]
<CSVLink
headers={header}
data={data}
separator=";"
asyncOnClick={true}
onClick={handleOnclick}
>
<button>DownLoad CSV</button>
</CSVLink>