I'm reading the book road to react.
A List (react component) function returns this element:
<Item key = {item.objectID} item = {item}/>
Item is again another react component, which is defined as
function Item(props){
const keys = Object.keys(props);
console.log("properties of Item Element:" + keys)
return(
<li>
<span>
<a href={props.item.url}>{props.item.title}:</a>
</span>
<span style={authorStyle}> {props.item.author},</span>
<span> {props.item.num_comments},</span>
<span> {props.item.points}.</span>
</li>
)
};
The strangest thing to me is that I would expect props to have two properties: key and item. However, the console only shows:
properties of Item Element:item
Why is this?
Edit: When I do console.log("props:" + props), I get
props:[object Object]