question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Carousel renders before children

See original GitHub issue
<OwlCarousel items={4}>
  {this.props.articles.map(
    (article, key) => (
      <div className="item" key={key}>
        ...
      </div>
    )
  )}
</OwlCarousel>

When mapping carousel items from Props, carousel renders before items. And it’s rendered empty. Is there any way to overcome this problem?

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:1
  • Comments:7

github_iconTop GitHub Comments

2reactions
Balyasovcommented, Oct 5, 2018

Try to add key to the OwlCarousel

<OwlCarousel key={`carousel_${this.props.articles.length}`} items={4}>
  {this.props.articles.map(
    (article, key) => (
      <div className="item" key={key}>
        ...
      </div>
    )
  )}
</OwlCarousel>
0reactions
Shubhamdutta2000commented, Dec 15, 2020

I was facing same prblm its fixed by adding key to OwlCarousal component. Bt what actually happen and why its solved by adding key to component

Read more comments on GitHub >

github_iconTop Results From Across the Web

ReactJS : Child wont re-rendered when the parents state ...
I have been trying to re-render a contact list inside a Carousel by changing the state object in the parent class. The first...
Read more >
pure-react-carousel - npm
Lets you assemble the carousel components in the DOM in any order you desire so long as they are all children of a...
Read more >
The mystery of React Element, children, parents and re-renders
Looking into what is React Element, exploring various children vs parents relationship in React, and how they affect re-renders.
Read more >
How to Build a Simple Carousel in React | by Aakash Jha
A carousel is nothing more than several items being rendered in a parent container block — carousel-container , with the child — carousel-item...
Read more >
Making A Carousel - React Reveal
To make a carousel you'll need to import a makeCarousel function first. ... const Carousel = makeCarousel(CarouselUI); render ( <Carousel defaultWait={1000} ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found