JavaScript for WordPress Forums Gutenberg Development Conditional statements before/on save Reply To: Conditional statements before/on save

#45003
alantucker
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 🙂