React: Use a Ternary Expression for Conditional Rendering

So I completed this exercise using

this.state.userAge >= 18 ? buttonTwo : this.state.userAge === '' ? buttonOne : buttonThree

as the ternary expression.

Then did some playing around and noticed that

this.state.userAge === '' ? buttonOne : this.state.UserAge >= 18 ? buttonTwo : buttonThree

does not work as it always renders buttonThree even if I input an age above 18 and was wondering why that is?

It doesn’t work because you’ve mistyped userAge

I feel so stupid haha thanks so much for clearing it up

Dead easy mistake to make, and hard to see, stuff like this just becomes invisible once you’ve been looking at something for a while, just needed a fresh pair of eyes :slight_smile: