I'm really stuck with this issue, it looks very simple but I just cannot access childs of a parent Object, please someone assist. The picture below is the console log:
When I render this I don't see the results
const listItems = this.state.list.map((item, index) => <p>{item.title}</p>);
Of course when I try this.state.list.map((item, index) => <p>{item}</p>); I got the error bellow:
Objects are not valid as a React child
The main function:
componentDidMount = () => {
fire
.database()
.ref(`/feed/`)
.on('value', snapshot => {
var obj = snapshot.val();
var list = [];
for (let a in obj) {
list.push(obj[a]);
}
console.log(list);
this.setState({
list: list,
loading: false
});
});
};
A live session can be found here (Home.js) https://codesandbox.io/live/DR7WzY
EDIT : my last attempt
for (let a in obj) {
for (let b in obj[a]) {
console.log(b);
}
}
But it's empty!!
