You can use the isEmpty
function from Lodash to check if a given value is empty or not. Here is an example:
index.tsx429 chars14 lines
In this example, the isEmpty
function is used to check if various values are empty or not. If the value is empty, the function returns true
, otherwise it returns false
. Note that the function considers a value to be empty if it is null
, undefined
, an empty string, an empty object, an empty array, or the number 0
.
gistlibby LogSnag