This project displays the most popular articles from the New York Times using their public API. It includes a shimmer effect while the data is loading.
App.js
: The main component of the application. It sets up the basic layout and renders theArticlesContainer
component.ArticlesContainer.js
: Fetches the data from the New York Times API and manages the state of the articles. It renders a shimmer effect while the data is being loaded and anArticleList
once the data is fetched.ArticlesList.js
: Displays the list of articles. When an article is clicked, it shows more details about the article on the new page.Shimmer.js
: Displays a loading message while the data is being fetched.App.css
: Contains styles for the mainApp
component.ArticlesList.css
: Contains styles for theArticlesList
component.Shimmer.css
: Contains styles for theShimmer
component.
Make sure you have Node.js and npm installed on your machine.
- Clone the repository:
git clone https://github.com/g123ritz/nytimesarticles.git cd nyt-most-popular-articles
You can create this project either using CLI commands or using create-react-app
.
-
Initialize a new project:
npm init
-
Install development dependencies:
npm install -D parcel
-
Install React and ReactDOM:
npm install react npm install react-dom
-
Start the project:
npm start
-
Create a new React app:
npx create-react-app nyt-most-popular-articles cd nyt-most-popular-articles
-
Start the development server:
npm start
Replace the api-key
in ArticlesContainer.js
with your own New York Times API key. You can get it from New York Times Developer Portal.
Start the development server:
npm start