JSFiddle - React, Tailwind, and code Playground
JavaScript
defValue=0;
if (defValue=='') defValue=null;
alert(defValue); //alerts null
defValue=1;
if (defValue=='') defValue=null;
alert(defValue); //alerts 1
defValue=0;
if (defValue=='') defValue=null;
alert(defValue); //alerts null
defValue=1;
if (defValue=='') defValue=null;
alert(defValue); //alerts 1