I came across a condition which made me strange. I am working on React in that I have given a condition on a render method like this:
if (!this.props.allYearData || !this.props.Growth)
return <Loading />;
However, my page always shows the loading symbol. I console data what I have given in if condition and both data was in define state, but my Growth was showing 0 value., so I commented out this.props.Growth
and my page loaded. So I am just wondering why JavasSript didn't consider 0 as a defined value? I always has impression that !
means undefined
. Can someone explain this?