You must wrap both your elements in some container. This container is treated as a "whole", no matter what is inside it. In this example below I am using an empty Fragment container
Also, notice that only the piece of code written directly after the && is executed if the first part, before the && was resolved as true. (Read more about &&).
This is why you must wrap everything which should be conditionally-rendered in a container, because if you didn't, only the first element would have been conditionally rendered and anything after it would always get rendered
{ this.state.images > 1 && <>
<LeftArrow goToPrevSlide={this.goToPrevSlide} />
<RightArrow goToNextSlide={this.goToNextSlide} />
</>
}
{[<LeftArrow key="left" goToPrevSlide={this.goToPrevSlide} />, <RightArrow key="right" goToNextSlide={this.goToNextSlide} />].filter(() => this.state.images > 1)}could work in this case, though a bit ugly looking (and renders the arrows even when they're not used){this.state.images > 1 && ...}You'll also need to wrap your two child components with a single parent. You can use a Fragment<>...</>or a<div>or w/e.