reactjs-giphy

1.0.3 • Public • Published

reactjs-giphy

React component to work with GIFs (Giphy API)

Install

npm install reactjs-giphy

Usage

Trending

import React, { Component } from 'react'
 
import Giphy from 'reactjs-giphy'
 
class Example extends Component {
  renderContent({ data }) {
    return data.map(gif => <img key={gif.id} src={gif.images.preview.url} />)
  } 
 
  render () {
    return (
      <Giphy render={this.renderContent} />
    )
  }
}

By GIF ID

import React, { Component } from 'react'
 
import Giphy from 'reactjs-giphy'
 
class Example extends Component {
  renderContent({ data }) {
    return (<img src={gif.images.preview.url} />)
  } 
 
  render () {
    return (
      <Giphy id={someId} render={this.renderContent} />
    )
  }
}

Props

render

handler returns gifs from Giphy API (required, function)

id

gif ID that should be fetched from Giphy API (string)

searchTerm

search gifs by title (string)

offset

skip some count gifs from start (number)

apiKey

Giphy API api key (string)

upload

upload provided Gif (object ex. {username: 'John', src: 'Some gif source'})

sortBy

Sort by Gif's uploaded time (string ex. 'ASC', 'DESC')

License

MIT © ArmanGhazaryan94

Package Sidebar

Install

npm i reactjs-giphy

Weekly Downloads

2

Version

1.0.3

License

MIT

Unpacked Size

607 kB

Total Files

18

Last publish

Collaborators

  • ghazaryanarmans