Skip to content

Conversation

@jamesmcallister
Copy link

No description provided.

import { SingleArticle } from "./singleArticle";

export const ArticleList = ({ articles, title }) => (
<React.Fragment>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

export const ArticleList = ({ articles, title }) => (
<React.Fragment>
<h1 className="articleList__title"> {title} </h1>
{articles.map((data, i) => <SingleArticle key={i} {...data} />)}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using index as key might cause weird bugs

<p className="article__description">{description}</p>
<div className="article__publishedAt">
Posted
{" " + distanceInWordsToNow(publishedAt)} ago
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

);
}, 30000);
}
// fetchClick(event) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid committing commented out code

<button type="submit">Submit me</button>
</form> */}
<article className="article__list">
{this.state.loading
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very nice

@@ -0,0 +1,32 @@
const apiKey = "e3f2c5f01b3a456eb81a95a2f0e85fc2";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

like how the key is broken out into own variable

.then(response => response.json())
.then(data => ({
title: "Top Headlines - USA",
articles: data.articles.filter(data => data.urlToImage)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice bit of filtering

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants