I am new to react, so I am not sure how to call it. As a result, I apologize if this question was asked before. What I probably want to do is maping data, but I am not sure how to do it.
componentDidMount() {
fetch("https://reqres.in/api/users?page=3")
.then(data => {return data.json()})
.then(datum => this.setState({client:datum.data}));
}
Above is my fetch component. The data that is taken from the API include the id, lastname, firstname. However, I want to assign id as slug instead and then change firstname+lastname into name
So, instead of seeing this inside the client array,
id:7
first_name:"Michael"
last_name:"Lawson"
I want to see something like this:
slug:7
name:"Michael Lawson"