use-instagram-account-info
v1.0.0
Published
React Hooks to get Instagram account information
Downloads
388
Maintainers
Readme
use-instagram-account-info
React Hooks to fetch instagram account information. instagram-account-info
as main dependency.
To install it:
yarn add use-instagram-account-info
// or
npm install use-instagram-account-info --save
API Explained
In your app, you can add:
import { useInstagram } from 'use-instagram-account-info';
function App() {
const info = useInstagram(username)
...
}
info
object is composed of:
info
: It is eithernull
or an object.info.followers
:Number
of followersinfo.following
:Number
of people followinginfo.isPrivate
:Boolean
info.isVerified
:Boolean
info.posts
:Number
of postsinfo.profileImage
:String
, Avatar Url
Example
import { useInstagram } from 'use-instagram-account-info';
function App() {
const username = 'katalonne'
const info = useInstagram(username);
if (!info) {
return null;
}
const {
followers,
following,
isPrivate,
isVerified,
posts,
profileImage
} = info;
return (
<div>
<p>{username} has {followers} followers.</p>
<p>{username} is following {following} people.</p>
<p>{username} has profile set to private: {isPrivate} </p>
<p>{username} has verified profile: {isVerified}.</p>
<p>{username} has {posts} posts.</p>
<p>{username} has {followers} followers</p>
<img src={profileImage} />
</div>
);
}
License
MIT License © Catalin Besleaga