Skip to main content

How to add Lottiefile to your Next JS Website

Step 1: Install the react-lottie package The first thing you need to do is install the react-lottie package. Open your terminal and run the following command:

                    npm i react-lottie


Step 2: Add Lottie Animation to Your Component Once you have successfully installed Lottie. it's time to add the animation to your React component. To do this, navigate to the Component folder in your project.

In this folder, you'll need to paste the Lottie animation file (which typically has a .json extension). Make sure you've obtained the desired Lottie animation file beforehand, or you can find many free and exciting animations online.

Next, open the React component where you want to add the animation. Simply add the <AnimationPage /> component, or if you prefer to use a different HTML element, you can use your desired className attribute.

That's it! You've successfully integrated the Lottie animation into your React app. When you run your application, you'll be greeted with a stunning animation that enhances the user experience and adds a touch of interactivity to your project.


import React, { Component } from 'react';
import Lottie from 'react-lottie';
import animationData from 'your lottie svg file location'
class AnimationPage extends Component {
render() {
const defaultOptions = {
loop: true,
autoplay: true,
animationData: animationData,
renderer: 'svg'
}
return (
<div
<Lottie
options={defaultOptions}
height={500}
width={700}
/>
</div>
)
};
}
export default AnimationPage;

Comments

Popular posts from this blog

Fear

When it comes to negativity, our minds work extremely quickly, and we discover a lot of things, but when it comes to positivity, we just ignore it because we don't want to think about it or discuss it. We've shaped our thinking in such a way that we don't think optimistically and only stay within our comfort zones. We are constantly afraid of doing anything that puts us under strain. We consider more before doing anything, and if we don't do it, we regret it and wonder why we didn't do it or speak up. Fear is the most significant issue in our lives. Fear of what people will say, think, and assume. We always strive to project a positive image in front of people that cause us problems. We should provide happiness to ourselves first, and then let our fears out because if they don't, we won't be able to grow or work since we have fear in our minds. We should live like birds since birds rely on their wings more than anything else. But in this day and age, we have...

Thoughts

Every day is a fresh start in our lives in light of the fact that consistently goes and a new day comes where we start our day with a fresh start. In some cases, we neglect to be content with regards to little things and consistently center around different things however never center around the present. Partake in your present since you don't have any idea what will happen tomorrow yet you have the current which you can live completely. How about we take a situation, A young lady falls into a dull backwoods with a lightning storm. she has no clue about how to treat it pouring intensely and there was no billboard to move. She was caught in the timberland alone. she was making an honest effort to be saved however she couldn't move since her leg stalled out in the mud. However, she never believed that she will kick the bucket. She made an honest effort and she didn't figure out how to leave the woods. She just thought about the subsequent stage and she emerged from the timber...

Priorities

Why is it challenging to establish trusting friendships? Often, our efforts are directed toward ensuring the contentment of others, while we neglect our own well-being. It is imperative to prioritize self-care and self-fulfillment, as external individuals may perpetually harbor doubts, issues, or display discontentment. Our internal satisfaction is contingent upon us, and it is incumbent upon us to cultivate it. We possess the capacity to foster our own happiness, and therefore, we should cease granting precedence to external entities and instead focus on our own thoughts, emotions, and actions. By recognizing our agency in achieving happiness and taking proactive measures to nurture it, we empower ourselves to transcend reliance on others for emotional well-being. Ultimately, we must assume full responsibility for our own happiness rather than attributing it to external sources or circumstances. Shifting our priorities to place ourselves, our thoughts, and our opinions at the forefron...