A responsive React application that displays the most popular news articles from The New York Times. The app fetches data from the NYT API and presents it in a clean, user-friendly interface using Material-UI components.
- Dynamic News Feed: Fetches and displays the most popular news articles from The New York Times.
- Responsive Design: Optimized for desktop and mobile devices using Material-UI.
- Loading State: Displays a spinner while fetching data.
- Error Handling: Gracefully handles API errors.
- Reusable Components: Modular design with reusable
CardandMaincomponents. - Unit Testing: Includes tests for key components using React Testing Library.
Replace this with an actual screenshot of your app.
Follow these instructions to set up and run the project locally.
- Node.js: Ensure you have Node.js installed. Download Node.js
- npm: Comes bundled with Node.js.
-
Clone the repository:
git clone https://github.com/your-username/news-app.git cd news-app -
npm install
-
Create a .env file in the root directory and add your NYT API key:
REACT_APP_API_KEY=your-nyt-api-key
-
npm start
-
For running jest test 6C83 cases: npm test
-
For running end to end cypress test cases: npx cypress open
Project Structure:
src/ ├── components/ │ ├── Card.js # Reusable card component for displaying articles │ ├── Main.js # Main component for rendering the news feed │ ├── NewsDetails.js # Component for detailed article view (optional) ├── css/ │ ├── Main.css # Styles for the Main component ├── test/ │ ├── mockdata.js # Mock data for testing │ ├── News.test.js # Unit tests for the Main component ├── App.js # Root component ├── index.js # Entry point ├── App.css # Global styles