React: Conditionally Rendering Components with Ternary Operator

Tao Liu
1 min readFeb 3, 2019

--

The code below shows how a ternary operator can be used inside Components. The ColorBox component recursively renders itself until the opacity prop goes below 0.2.

Here is what ends up on the DOM:

--

--

No responses yet