JavaScript for WordPress › Forums › Gutenberg Development › Conditional statements before/on save › Reply To: Conditional statements before/on save
April 12, 2018 at 8:26 am
#45003
Participant
Thanks, I opted for the following in the end…
const isTextEmpty = text.length > 0 ? false : true;
const isUrlEmpty = url.length > 0 ? false : true;
{ (isTextEmpty || isUrlEmpty) ? ({}) : ( { text } ) }
Thanks again for all your help 🙂