Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Abijith26
Abijith26

Posted on

Implementing Image Carousel in NextJS

Image description

File: page.tsx

import React from "react";import FeaturedScreen from "./components/FeaturedScreen/FeaturedScreen";import Header from "./components/Header/Header";export default function Home() {  return (    <main>      <Header />      <FeaturedScreen />    </main>  );}
Enter fullscreen modeExit fullscreen mode

File: FeaturedContent.js

const ImageDetails = [  {    id: 1,    movieName: "KAHAANI",    language: "Hindi",    img: "/IC-1.jpg",  },  {    id: 2,    movieName: "URI",    language: "Hindi",    img: "/IC-2.jpg",  },  {    id: 3,    movieName: "SPIDERMAN - NO WAY HOME",    language: "English",    img: "/IC-3.jpg",  },];export { ImageDetails };
Enter fullscreen modeExit fullscreen mode

File: FeaturedScreen.tsx

import { Carousel } from "react-responsive-carousel";import "react-responsive-carousel/lib/styles/carousel.min.css"; // requires a loaderimport { ImageDetails } from "../../../public/FeaturedContent.js";// Source for Image and its informationexport default function FeaturedScreen() {  return (    <div>      <Carousel autoPlay>        {ImageDetails.map((movie) => (          <div key={movie.id}>            <img src={movie.img} alt="carouselImage-1" />          </div>        ))}      </Carousel>    </div>  );}
Enter fullscreen modeExit fullscreen mode

I am trying to implement a image carousel. but i am getting this error.
can anyone help me with this?

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

  • Joined

Trending onDEV CommunityHot

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp