Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jharrilim/use-rss
React hook for RSS feeds
https://github.com/jharrilim/use-rss
hook react rss
Last synced: about 1 month ago
JSON representation
React hook for RSS feeds
- Host: GitHub
- URL: https://github.com/jharrilim/use-rss
- Owner: jharrilim
- License: mit
- Created: 2020-05-08T02:18:46.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-06T05:18:02.000Z (about 2 years ago)
- Last Synced: 2024-12-21T23:07:40.983Z (about 2 months ago)
- Topics: hook, react, rss
- Language: TypeScript
- Homepage: https://npmjs.org/@jharrilim/use-rss
- Size: 1.24 MB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# useRss Hook
![npm (scoped)](https://img.shields.io/npm/v/@jharrilim/use-rss?style=flat-square)
![npm](https://img.shields.io/npm/dt/@jharrilim/use-rss?style=flat-square)
![Node.js CI](https://github.com/jharrilim/use-rss/workflows/Node.js%20CI/badge.svg)React hook for RSS feeds.
## Install
```sh
npm i @jharrilim/use-rss
```## Usage
[![Edit use-rss-demo](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/use-rss-demo-2eqdg?fontsize=14&hidenavigation=1&theme=dark)
```tsx
import React from 'react';
import useRss from '@jharrilim/use-rss';export const MyApp = () => {
const redditFeed = useRss('https://reddit.com/.rss');
if (redditFeed === null)
returnLoading...
;
return (
{redditFeed?.title}
{redditFeed?.description}
{redditFeed?.items.map((item, i) => (
{item?.title}
{item?.creator} - {item?.pubDate}
{item?.content}
))}
);
}
```