DEV Community

Cover image for React Animation using React-reveal
Shubham Tiwari
Shubham Tiwari

Posted on

React Animation using React-reveal

Hello Everyone Today i am going to show you how to use animation in React using React-reveal

React Reveal is high performance animation library for React. It's MIT licensed, has a small footprint and written specifically for React in ES6. It can be used to create various cool reveal on scroll effects.

The best part is animation will happen only if you scroll down to the element not on loading time. At the time of loading page ,only those elements will have animation effect which is visible to the screen.Other parts animation will take effect when you scroll down to them.

Here is the docoumentation link for React-reveal-

Run this command in your terminal-

npm install react-reveal --save
Enter fullscreen mode Exit fullscreen mode

Here you will see how to use it-

 <Fade left>
//You other code such heading , paragraph,card ,etc 
//In this block ,every thing will be animated
Enter fullscreen mode Exit fullscreen mode

You can use following values for the effect

  • top
  • down
  • left
  • right

Here is an example code -

import React,{useState,useEffect} from 'react'
import Fade from 'react-reveal/Fade'

function App() {

  const [todos, setTodos] = useState([])

  useEffect(() => {
    .then(res => res.json())
    .then((data) => {
    }, [todos])

  return (
    <div className=""> 

    <h1 className="text-primary text-center display-4 mb-5">React fetch api using useEffect</h1>
      <div className="text-center" style={{display:"block",width:"50%",margin:"0 auto"}}>
        <div style={{display:"flex",flexDirection:"column",justifyContent:"center",justifyItems:"center",width:"100%"}}>
          { => (
            <Fade left>
             <div className="card bg-dark text-light my-3">
             <div className="card-body">
               <h5 className="card-title">{todo.title}</h5>
               <h6 className="card-subtitle mb-2 text-muted">
               { todo.completed &&
               { !todo.completed &&

export default App

Enter fullscreen mode Exit fullscreen mode

What we are doing here is fetching some data from api and displaying it in cards
I have put the cards in the animation
So, all the cards will have fade effect on scrolling down

1.You need to install bootstrap also either using cdn or npm if you are going to use this code to see the effect
2.The other api fetching part is discussed in previous blog.

I am newbie developer so please highlight any mistake if you find any in this or any other post.

Instagram -

Top comments (0)