1
00:00:00,000 --> 00:00:02,900
My React cart is empty.

2
00:00:02,900 --> 00:00:05,800
Why is there a zero just sitting there?

3
00:00:05,980 --> 00:00:08,950
You're using the list length with logical AND.

4
00:00:08,950 --> 00:00:11,850
When the length is zero, that expression returns zero.

5
00:00:11,850 --> 00:00:13,700
React renders numbers.

6
00:00:13,880 --> 00:00:17,480
I thought a false condition meant render nothing.

7
00:00:17,660 --> 00:00:19,930
Make the left side a boolean.

8
00:00:19,930 --> 00:00:21,450
Length greater than zero,

9
00:00:21,450 --> 00:00:22,820
or double NOT on the length.

10
00:00:22,820 --> 00:00:25,300
With an empty list, both give false.

11
00:00:25,300 --> 00:00:27,700
Logical AND then returns false.

12
00:00:27,700 --> 00:00:29,130
React skips false,

13
00:00:29,130 --> 00:00:31,020
but renders the number zero.

14
00:00:31,200 --> 00:00:33,060
Same cart. Remove the last item.

15
00:00:33,060 --> 00:00:35,200
No list. No stray zero.

16
00:00:35,380 --> 00:00:36,510
Great.

17
00:00:36,510 --> 00:00:38,060
Zero items.

18
00:00:38,060 --> 00:00:40,460
One squatter evicted.
