In my Comment.js
component I am able to retrieve the data from the story that was clicked on based off its ID. In my <li/>
tags if I put in {comment.id}
then I get the ID for the story. But what I am trying to do is access the comments and to do that according to Hacker News API I have to put in {comment.parent}. But when I do that I don’t get anything back in my list element.
`import React, {useState, useEffect} from 'react'
import Header from './Header.js'
import {getStoryTitle} from '../API.js'
export default function Comments({match}) {
const { id } = match.params;
const [comment, setComment] = useState({});
useEffect(()=> {
getStoryTitle(id).then(data => setComment(data))
}, [])
return (
<>
<Header />
<h1 className="story-title">{comment.title}</h1>
<ul>
<li>{comment.by}</li>
<li>{[comment.id]}</li>
</ul>
</>
)
}
`