Include JSON Lottie files in Next JS Project

Sometimes, there might be situation arises where we have to add JSON Lottie files in our project for improving UI and also making user friendly.

We cannot directly use Lottie files in Next JS project instead we have to do the followings.

Install lottie-react using npm i lottie-react –legacy-peer-deps

Create a folder to add Lottie JSON Files Under Public Folder.

Add the Downloaded JSON file in this folder.

Create a component for Lottie.

Import required files and Call the Lottie in the component

Add this component where we have to attach the Lottie file.

Now we can see the lottie file is successfully added to our project and can be used where ever as our requirement

Leave a comment

Your email address will not be published. Required fields are marked *