There seems to be an issue with mapping functionality not functioning properly within the react

Does anyone have experience using mapping with react bootstrap carousel? I'm having trouble getting it to work properly.

import React from "react";
import "../../styles/Banner.css";
import Carousel from "react-bootstrap/Carousel";

const data = [
  "https://rukminim1.flixcart.com/flap/1680/280/image/1defb861e409319b.jpg?q=50",
  " https://rukminim1.flixcart.com/flap/1680/280/image/685712c6cefb3c02.jpg?q=50",
  "https://rukminim1.flixcart.com/flap/1680/280/image/8d4150cc4f3f967d.jpg?q=50",
  "https://rukminim1.flixcart.com/flap/1680/280/image/685712c6cefb3c02.jpg?q=50",
];

const Banner = () => {
  return (
    <Carousel className="carasousel">
      <Carousel.Item>
        {data.map((imag, i) => {
          return (
            <>
              <img src={imag} alt="img" key={i} className="banner_img" />
            </>
          );
        })}
      </Carousel.Item>
    </Carousel>
  );
};

export default Banner;

The carousel is displaying all four items at once instead of one. How can I fix this issue?

Another concern I have is removing the lower slide indicator from the carousel. Is there a way to do this?

https://i.sstatic.net/alkPq.png

Answer №1

One suggestion could be:

{data.map((image, index) => (
      
          <img src={image} alt="image" key={index} className="banner_image" />
      
    )}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Avoiding cross-site scripting vulnerabilities, an AJAX response will return an HTML response

function accessAccount() { var errorMessage = ""; var checkedResult = true; $(".errorDisplay").hide(); var accountNumber = document.getElementById('customerAccountNumber').value; var accountType = document.getElementById(&apos ...

EVO PDF: Compare Tables and Headers that Stay in View

I am currently using the EVO PDF, Html to PDF generator, and I have encountered a puzzling scenario that seems unsolvable. I'm not certain if there is a built-in solution within the software itself. In my project, I have two metric data tables positi ...

Display only one collapse open at a time using Vue 3 and Bootstrap 5

I am currently utilizing Bootstrap5 and Vue 3. In my project, I have several buttons, each of which triggers a different collapse. My goal is to have only one collapse open at a time, meaning that when I open one collapse, all the others should close. How ...

What is the reason that utilizing $("input").first() does not function properly on Google Forms?

While practicing with Selenium, I encountered an issue while using this Google form. Specifically, I found that I couldn't select the first input field by using $("input").first() To confirm this issue, I turned to the web browser (Firefox) console t ...

Retrieve the data from an HTML table by triggering a button click

Hey there! I have a table that includes an update button, and I need to be able to retrieve a specific column from the row where the button was clicked. Here's the HTML code for the table: <table class="table table-hover" style="width: 99%"> ...

Trouble with initial API call in Redux action creator

Recently, I went through a Redux tutorial and decided to start implementing it. I have an API call that needs to happen from Redux as soon as the page loads. While ComponentDidMount can achieve this, I am curious to learn how Redux plays a role in this pr ...

Randomizer File Name Maker

I was questioning the behavior of Multer Filename. If Multer stores files with random filenames, is there a possibility of two files having the same name in Multer? In other words, if I am storing files from a large number of users, could the filenames e ...

Utilizing Bootstrap CSS within Vue's scope

I'm attempting to integrate Bootstrap into a Vue component while ensuring that all CSS is scoped. My initial approach was as follows: <style scoped> @import "~bootstrap/dist/css/bootstrap.css"; @import "~bootstrap-vue/dist/bootstrap-vue.css"; & ...

Scheduling tasks for jQuery/Javascript like a Cronjob

I'm currently working on a web application that predominantly uses PHP, however, I am incorporating jQuery/Javascript to retrieve Tweets from users' URLs at http://twitter.com/status/user_timeline/joebloggs.json?count=1&callback=. My aim is ...

Develop unique web components and distribute them across various frameworks

Currently, I am working on two projects that utilize Angular and React. I have noticed that certain components are duplicated in both projects. To streamline this process, I am considering creating a company library where I can develop custom components on ...

Issues with the responsiveness of Bootstrap 4.5.0 grid system

While following a Django tutorial, I encountered an issue with Bootstrap cards and CSS styling. Using the latest version (Bootstrap 4.5.0), I noticed that my responsive grid was causing the cards to overlap as I increased the screen size. Comparing it to t ...

React Native: Unable to print to the console with console.log()?

I find myself in a peculiar situation where I am attempting to track down a bug and log it on the console without any success so far. The post is requesting more information, but unfortunately, there isn't much to provide. Right now, my main focus is ...

Animate div visibility with CSS transitions and Javascript

I'm currently working on incorporating an animation into a div that I am toggling between showing and hiding with a button click. While I have the desired animation, I am unsure of how to trigger it using JavaScript when the button is clicked. Can any ...

What is causing the "ElementNotVisibleError: element not visible" to be thrown?

I am currently developing an automated testing script using Selenium with the webdriverJS (node.js approach). Within my application, there are various menus and submenus that I need to interact with. One specific task involves clicking a collapsible butt ...

Transcluding an element into an ng-repeat template in AngularJS: How can it be done?

Incorporating a carousel directive involves chunking the passed in array of items and mapping it into an array of arrays of elements. This structure then generates markup resembling the pseudo code provided below: <array of arrays> <array of i ...

Unable to refund items in the list box

I have been working on a code snippet to retrieve a list of items from a listbox. The listbox can contain any number of 10-digit numbers in multiple rows. However, when I run the code, the "NPIListBox.Items.Count" function only returns a count of 1, even w ...

The display block style is not functioning properly

I am experiencing an issue with my HTML design. Even after setting the display to inline-block, the logo and text are not appearing on the same line. .logo img { border-width: 0; height: auto; max-width: 100%; vertical-align: left; } .lo ...

What is the functionality of __proto__ when an object is initialized using Object.create(null)?

Take a look at this javascript snippet: var x = Object.create(null); x.bar = 2; var y = Object.create(x); console.log(y.bar); //outputs 2 console.log(y.__proto__); //outputs undefined y.__proto__ = null; console.log(y.__proto__); //outputs null console ...

The ajax function threw an error because it couldn't determine the length of an undefined property

When attempting to retrieve the number of objects within an array, I encountered an error stating 'length' of undefined. Here is my JavaScript code: .. success: function(data){ console.log(data.item.length); }, This is my P ...

Conducting extensive real-time counting processes using ajax

Within my online store, the ordering process is segmented into various forms, each corresponding to a product collection. With approximately 100 products of different sizes in each collection (totaling around 500 products), I anticipate having 10 collectio ...