1.0.0 • Published 6 years ago
use-instagram-account-info v1.0.0
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 --saveAPI 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 eithernullor an object.info.followers:Numberof followersinfo.following:Numberof people followinginfo.isPrivate:Booleaninfo.isVerified:Booleaninfo.posts:Numberof 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
1.0.0
6 years ago