contanier.js
...
getData = () => {
const originData = this.props.results;
const data = [
{ id: "test2", name: "test2", gender: "male", age: 2, birth_date : 2020-09-01 },
{ id: "test3", name: "test3", gender: "other", age:3, birth_date : 2020-09-02 },
];
this.setState({ data, filteredData: data });
};
Code i want
getData = () => {
const originData = this.props.results;
const data = [
{ origindata }
];
this.setState({ data, filteredData: data });
};
Currently, the id, name, age, gender, and birth_data are stored in'results'.
I defined'results' as 'origindata'.
I want to put id, name, gender, age, and birth_data from 'origindata' into const data.
But I can't figure out how to put it.
Anyone can tell me? Thank you in advance.
I'll provide more code if you like.
And if the title of the post is strange, let me know what to use as the title.