In my JSX, I have a case of conditional rendering logic - when element A does something (the render() function returns something other than null ), it also renders element B just above element A.
A sample code (simplified) would look like this:
function render() { let elemA = (<ElementA someProp={this.someVar} />); if (elemA.isNull()) { return ( <div> { ...someElements } </div> ); } return ( <div> { ...someElements } <ElementB /> { elemA } </div> ); }
So my question . Is there any way to check elemA.isNull() ?
javascript reactjs react-jsx
mdziekon
source share