react-use-medium
v1.0.5
Published
A react hook to fetch your Medium stories in a json format 📝
Downloads
7
Maintainers
Readme
react-use-medium
A React hook to fetch your Medium stories in json format 📝
Live Demo
Checkout live demo of react-use-medium below
Install
npm install react-use-medium
Import
import { useMedium } from "react-use-medium";
Usage
const { data, isFetched } = useMedium("<your-medium-username>");
| Returns | Description |
| -------------------- | -------------------------------------------------------------------------------------------------------- |
| data
: obj | an object having user's information and stories; {}
if username not found |
| isFetched
: bool | true
if username is a valid Medium username and data has been fetched; false
for all other scenarios |
Example
import React from "react";
import { useMedium } from "react-use-medium";
export default function Blogs() {
const { data, isFetched } = useMedium("dheerajmahra");
return isFetched ? <BlogList data={data}> : null;
}
License
MIT © Dheeraj Mahra