diff --git a/README.md b/README.md index 71dbb28..a88f019 100644 --- a/README.md +++ b/README.md @@ -30,49 +30,57 @@ Install through npm: ``` npm install --save react-lottie ``` +Install through yarn: +``` +yarn add react-lottie +``` ## Usage -Import pinjump.json.json as animation data +Import twitter-heart.json as animation data ```jsx -import React from 'react' -import Lottie from 'react-lottie'; -import * as animationData from './pinjump.json' - -export default class LottieControl extends React.Component { - - constructor(props) { - super(props); - this.state = {isStopped: false, isPaused: false}; - } - - render() { - const buttonStyle = { - display: 'block', - margin: '10px auto' - }; - - const defaultOptions = { - loop: true, - autoplay: true, - animationData: animationData, - rendererSettings: { - preserveAspectRatio: 'xMidYMid slice' - } - }; - - return
- - - - +import React, { useState } from "react"; +import Lottie from "react-lottie"; +import animationData from "./twitter-heart.json"; + +export default function LottieControl() { + const [animationState, setAnimationState] = useState({ + isStopped: false, + isPaused: false, + }); + + const defaultOptions = { + loop: true, + autoplay: true, + animationData: animationData, + rendererSettings: { + preserveAspectRatio: "xMidYMid slice", + }, + }; + return ( +
+ + + +
- } + ); } ```