Evening fellow developers,
I've rewrote a React JS application, but I've just hit a brick wall.
I have a form which adds some data to a database, specifically Firebase googles very own cloud based database solution. However, now I'm trying to fetch the data and render the components below but I'm sure how to do this.
What I receive from Firebase as a response :
Currently I'm just logging the response to show I do receive a response, I have set the response to an empty state. On render it gets set to the response from the server.
I want to be able to now convert the objects into an array which can then return an array of responses. The array will then be looped through and transformed into components which will get rendered below as I specified above.
Can someone assist me with this task as I'm very unsure how to accomplish this task. I will appreciate any responses to my question.
Github Link: https://github.com/AlexMachin1997/React-JS-Contact-Book What i have so far:
componentDidMount () {
axios.get("/contact.json")
.then(response => {
this.setState({
contactsArray: response.data.person
})
console.log(this.state.contactsArray)
})
//Any Errors The Error State Is Set To True
.catch (error => {
console.log(error)
})
}