How to add Loading Quotes in Next.js ?
Last Updated :
05 Jan, 2023
In this article, we are going to learn how we can add loading quotes in NextJs. NextJS is a React-based framework. It has the power to Develop beautiful Web applications for different platforms like Windows, Linux, and mac. The linking of dynamic paths helps in rendering your NextJS components conditionally.
Approach: To add loading quotes we are going to use the react-loader-quotes package. The react-loader-quotes package helps us to add loading quotes anywhere in our app. So first, we will install the react-loader-quotes package and then we will add quotes on our homepage.
Create NextJS Application: You can create a new NextJs project using the below command:
npx create-next-app gfg
Install the required package: Now we will install the react-loader-quotes package using the below command:
npm i react-loader-quotes
Project Structure: It will look like this.
Adding the Quotes: We can easily add the quotes in our app after installing the react-loader-quotes package. For this example, we are going to add quotes to our homepage.
Add the below content in the index.js file:
JavaScript
import React from "react";
import ReactLoaderQuotes from 'react-loader-quotes';
export default function MyQuotesSlider() {
return (
<div>
<h3>GeeksforGeeks Quotes</h3>
<ReactLoaderQuotes
loading={true}
quotes={[`GeeksforGeeks Quote 1`,
`GeeksforGeeks Quote 2`,
`GeeksforGeeks Quote 3`,
`GeeksforGeeks Quote 4`]}
/>
</div>
);
}
Explanation: In the above example first, we are importing the ReactLoaderQuotes component from the installed package. After that, we are adding the quotes using the quotes parameter of the ReactLoaderQuotes.
Steps to run the application: Run the below command in the terminal to run the app.
npm run dev
Output:
Similar Reads
How to Add Spinner Loader in Next.js ? In web applications, providing a smooth and responsive user experience is very important. One way to achieve this is by adding a spinner loader to indicate that a process is ongoing, such as fetching data or loading a new page. In this article, we'll explore how to add a spinner loader in a Next.js
2 min read
How to add Skeleton Loading in NextJS ? Skeleton Loading in Next.js provides a placeholder UI while content is loading, improving perceived performance and user experience. It visually represents loading elements, ensuring a smoother, more engaging application.ApproachTo add skeleton loading in nextjs application we are going to use the r
2 min read
How to Add Stylesheet in Next.js ? In Next.js, adding a stylesheet enhances your app's styling capabilities. Import CSS files directly in your components or pages using ES6 import syntax. Next.js optimizes and includes these styles in the build process, ensuring efficient and modular CSS management.In this post, we are going to learn
4 min read
How to Add Tweets in Next.js ? Adding tweets in Next.js involves using Twitter's embed feature or API to display tweets. You can embed tweets directly in components or fetch and display them using server-side rendering or client-side data fetching. In this article, we are going to learn how we can add Tweets in NextJs.ApproachTo
2 min read
How to fix "SWC Failed to Load" in Next js? SWC (Rust-based JavaScript compiler) is used by Next.js for optimization. This article guides you through resolving the "SWC Failed to Load" error, indicating Next.js can't find the SWC binary for compilation. What is the "SWC Failed to Load" Error?The error message (text-based description) indicate
1 min read