Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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)
return

Loading...

;
return (

{redditFeed?.title}


{redditFeed?.description}


{redditFeed?.items.map((item, i) => (

{item?.title}


{item?.creator} - {item?.pubDate}


{item?.content}



))}

);
}
```