@jharrilim/use-rss
v0.1.4
Published
React hook for RSS Feeds
Downloads
17
Readme
useRss Hook
React hook for RSS feeds.
Install
npm i @jharrilim/use-rss
Usage
import React from 'react';
import useRss from '@jharrilim/use-rss';
export const MyApp = () => {
const redditFeed = useRss('https://reddit.com/.rss');
if (redditFeed === null)
return <h1>Loading...</h1>;
return (
<div>
<h1>{redditFeed?.title}</h1>
<p>{redditFeed?.description}</p>
{redditFeed?.items.map((item, i) => (
<div key={item?.title ?? i}>
<h2>{item?.title}</h2>
<h3>{item?.creator} - {item?.pubDate}</h3>
<p>{item?.content}</p>
</div>
))}
</div>
);
}