Take a look at the following example:
In the above example, we have passed the boolean values to the isDeliverable and isOutOfStock props by wrapping them inside curly braces {}, as we did in the previous chapters.
However, when the value of a boolean prop is true, we can omit the value and only mention the property name. Here is the updated code:
Here we have kept the isDeliverable attribute at the beginning to give a better visual hierarchy. We recommend this approach for passing the boolean true to a component.
Similarly, we can set an attribute to false by omitting the property. For example, isOutOfStock can be set to false like this:
When we omit an attribute, it will be implicitly assigned the value undefined, which is falsy. However, we do not recommend this method, as the value of undefined may not be suitable for all cases.