precondition rendering react native code example
Example 1: jsx if block
render () {
return (
{(() => {
if (someCase) {
return (
someCase
)
} else if (otherCase) {
return (
otherCase
)
} else {
return (
catch all
)
}
})()}
)
}
Example 2: if else render react
render() {
const isLoggedIn = this.state.isLoggedIn;
return (
{isLoggedIn ? (
) : (
)}
);
}