according to react doc
Booleans, Null, and Undefined Are Ignored
false
, null
, undefined
, and true
are valid children. They simply don’t render. These JSX expressions will all render to the same thing:
https://reactjs.org/docs/jsx-in-depth.html#booleans-null-and-undefined-are-ignored
so
class x extends Component{
render(){
return(null);
}
}