Geetanjali Katare
Geetanjali Katare

Reputation: 63

My bootstrap carousel is not working properly in react

I don't know why my carousel's not working properly, can anybody tell me how to fix this issue. My codesandbox link :- https://codesandbox.io/s/nice-heyrovsky-8yucf?file=/src/Prompts.jsx

Upvotes: 0

Views: 291

Answers (1)

Sulman Azhar
Sulman Azhar

Reputation: 1079

You are creating carousel-inner multiple times but in reality you only need to render that one time and render carousel-items multiple times

I refactored your code a bit too so it only talks to the relevant dom elements

Also, I somewhat agree and disagree with christ here. Yes you should opt for react-boostrap library for this kind of stuff because they provide components for every item however if you ever use it then do explore the rendered version of it on the browser and then you will realize that its the same as a simple bootstrap library with same class names etc. But its mostly depends on how you use any library.

Anyway, I hope this codesandbox helped you if didn't then let me know. Happy coding

https://codesandbox.io/s/suspicious-tu-55u2h?file=/src/Prompts.jsx

Upvotes: 1

Related Questions