Check for empty string in JSX

You could check for trimmed string:

{this.props.description.name.trim() == ""}

This trims the string (which removes whitespace and newlines) and then check is if it's an empty string. Here's a CodePen demonstration.


You can easily to trim the text and compare with empty string. Let try:

{((this.props.description.name.trim() =="") || (this.props.description.name.trim().length==0))

to see how it's work. I've seen you remind about Reducer? You are using Redux, aren't? If you use Redux, for handling form data, you could use Redux Form (https://github.com/erikras/redux-form) to save your time.