react.js determines whether the input content is empty

1. There are many ways to judge whether the input is empty.
2. Share your valid code here

纯属代码分享 直接复制粘贴即可用

3. If
it is still empty after removing the line breaks, removing spaces, etc.

    if (textContent.replace(/(^\s*)|(\s*$)/g, '').replace(/[\r\n]/g, '') === '') {
    
    
      Toast.offline('内容不能为空', 1);
      return;
    }

Guess you like

Origin blog.csdn.net/weixin_45416217/article/details/107702366