You can achieve what you are saying by using Immediately Invoked Function Expression (IIFE)
render() {
return (
<View style={styles.container}>
{(() => {
if (this.state == 'news'){
return (
<Text>data</Text>
)
}
return null;
})()}
</View>
)
}
Here is the working example:
But, In your case, you can stick with the ternary operator