newsdataapi
v1.0.3
Published
React Hook for NewsData.io API
Downloads
411
Readme
🚀 Overview
newsdataapi is a lightweight, dependency-free React Hook client for accessing the NewsData.io API. It supports all available endpoints and handles validation, pagination, and parameter safety out of the box.
📦 Installation
npm install newsdataapi📦 Usage
import useNewsDataApiClient from "newsdataapi";
const { latest, archive, crypto, sources } = useNewsDataApiClient("YOUR_API_KEY");
📦 Supported Endpoints
Each function accepts parameters as an object. All parameters are validated against NewsData.io Documentation
- latest(params)
latest({ q: "ai", country: "us", language: "en" });
- archive(params)
archive({ q: "elections", from_date: "2023-01-01", to_date: "2023-03-01" });
- crypto(params)
crypto({ q: "bitcoin", coin: "btc"});
- sources(params)
sources({ country: "us", language: "en" });
