In my opinion you should always use undefined. because it is the natural value.
When a prop is not there, it is undefined. When ever you see a null value, that means a developer put it in place.
Also most often I don't care. because I write if ( myValue ) { ... }. It will work in both cases. just need extra condition if it could be an empty string or 0. For going into the positive case.
You wrote a nice documentation around the topic. What is your opinion?
In my opinion you should always use
undefined
. because it is the natural value.When a prop is not there, it is
undefined
. When ever you see anull
value, that means a developer put it in place.Also most often I don't care. because I write
if ( myValue ) { ... }
. It will work in both cases. just need extra condition if it could be an empty string or0
. For going into the positive case.You wrote a nice documentation around the topic. What is your opinion?
Yeah, we shouldn't put
null
deliberately.Undefined
is normally easy to handle as well in conditionals.