A fully functional news application built with React and React Router, powered by the NewsAPI. Users can view the latest news, filter by category, and search for specific topics.
- π Search for news using keywords
- ποΈ Browse news by category (e.g., technology, sports, etc.)
- π Navigate between pages like Home, About, and News Feed
- π§ Persistent Navbar for navigation
- π§Ύ Modular structure with reusable components (e.g.,
Card,Navbar)
.
βββ components
β βββ About.jsx
β βββ Card.jsx
β βββ Home.jsx
β βββ Navbar.jsx
βββ App.jsx
βββ index.css
βββ index.js
βββ README.md
- React (with Hooks)
- React Router DOM
- Fetch API
- NewsAPI.org
This project uses NewsAPI.org to fetch news. You must include your API key in the fetch URLs.
In the code:
const response = await fetch(
`https://newsapi.org/v2/everything?q=keyword&apiKey=YOUR_API_KEY`
);Replace YOUR_API_KEY with your actual API key.
Note: You can get a free API key by signing up at https://newsapi.org
React Router is used to navigate between the following pages:
/β Displays fetched news using theCardcomponent/homeβ Shows the Home page/aboutβ Shows the About page
The Navbar component stays visible across all routes for seamless navigation.
git clone https://github.com/your-username/react-news-app.git
cd react-news-appnpm installnpm run devThe app will be available at http://localhost:5173/ (or another port if you're using Vite).
- NewsAPI.org for the free news data
- React Router for navigation
- Built with β€οΈ by Devesh Singh