Super easy Giphy API support for ReactJS
Needs axios
as a dependency
npm install --save axios
yarn add axios
Note: Make sure that you have installed the correct version of
react(>= v16.8.0)
andreact-dom(>= v16.8.0)
.
npm install --save react-hooks-giphy
yarn add react-hooks-giphy
import Giphy from "react-hooks-giphy";
<Giphy />
<Giphy tag="happy" />
<Giphy triggers={[triggers]} />
const config = {
title: true
};
<Giphy {...config} />;
import React, { useState } from "react";
import ReactDOM from "react-dom";
import "./styles.css";
import Giphy from "react-hooks-giphy";
function App() {
const [flag, triggerFlag] = useState(false);
return (
<div className="App">
<h1>React Hooks Giphy</h1>
<p> Random Gif </p>
<Giphy />
<p> Happy Gif </p>
<Giphy tag="happy" />
<p> Happy Gif with a trigger to refresh Gif</p>
<Giphy tag="happy" triggers={[flag]} />
<button onClick={() => triggerFlag(!flag)}>Get another gif</button>
</div>
);
}
const rootElement = document.getElementById("root");
ReactDOM.render(<App />, rootElement);
Node >= v8 LTS
- Clone the project to local disk
npm install
npm start