I am developing spfx web part for SharePoint Online using React and pnp controls
I am using pnp control Carousel
URL for the actual control: https://github.com/SharePoint/sp-dev-fx-controls-react/blob/master/docs/documentation/docs/controls/Carousel.md
<Carousel
buttonsLocation={CarouselButtonsLocation.top}
buttonsDisplay={CarouselButtonsDisplay.block}
contentContainerStyles={styles.carouselContent}
containerButtonsStyles={styles.carouselButtonsContainer}
isInfinite={true}
element={this.carouselElements}
onMoveNextClicked={(index: number) => { console.log(`Next button clicked: ${index}`); }}
onMovePrevClicked={(index: number) => { console.log(`Prev button clicked: ${index}`); }}
/>
In above control element={this.carouselElements}
property needs array of element distinguished based on the 'key' property
Now I have created another component which renders as below:
public render(): React.ReactElement<IHomePageCarouselProps> {
return (
<div className={styles.homePageCarousel}>
{/* <div className="owl-carousel owl-theme owl-banner "> */}
<div key="1">
<a href="#">
<img src="images/banner_1.jpg " alt="banner" className="rounded-top" />
</a>
<div className="bg-white rounded-bottom p-10">
<span className="font-color-green font-weight-bold ">
News title will show here. News title will show here. News title will show
here. News title will show here. News title will show here. News title will
show here. News title will show here. News title will show here. ...
</span>
</div>
</div>
<div key="2">
<a href="#">
<img src="images/banner_1.jpg " alt="banner" className="rounded-top" />
</a>
<div className="bg-white rounded-bottom p-10">
<span className="font-color-green font-weight-bold ">
News title will show here. News title will show here. News title will show
here. News title will show here. News title will show here. News title will
show here. News title will show here. News title will show here. ...
</span>
</div>
</div>
{/* </div> */}
</div>
)
}
using above component in Carousel element property as below:
element={<HomePageCarousel />}
but HomePageCarousel cannot render without main div which is the requirement of React. Can somebody help me how can I output or extract array of elements?