I want to add a div to my render objects depending on a condition. Right now I am using this code
render() {
return (
<div>
{this.test === this.someValue ? <div> some view </div> : <div> /div>}
...... // other components
</div>
)
}
this is working but I don't like the : <div> /div> because I don't need it. Is there any way to just use an if instead of if else?
nullinstead of an emptydivas wellrecompose's branch. Have a look at it here : github.com/acdlite/recompose/blob/master/docs/API.md#branch