title: How to check null condition in react Native
body: <p>Like normally we write </p>
  
  <pre><code>if(num1==""){
  do nothing
  }else{
  do something} 
  </code></pre>
  
  <p>how do we write it in react native syntax, below is my code</p>
  
  <p>I already tried a lot but failed to get the point why is it giving an error</p>
  
  <pre><code>import * as React from 'react';
  import { Text, View, StyleSheet, TextInput, Button, Alert } from 'react-native';
  import Constants from 'expo-constants';
  import AssetExample from './components/AssetExample';
  import { Card } from 'react-native-paper';
  
  export default class App extends React.Component {
    state = {
      num1 : "",
       num2 : "",
       result: ""
    }
  
    addBtnPressed = () =&gt; {
      this.setState({
        if({num1 == "" || num2 == ""}){
          alert('Field Empty')
        }else{
          result: eval(this.state.num1 +"+"+ this.state.num2)
        }
       });
    }
    render() {
      return (
        &lt;View style={styles.container}&gt;
          &lt;TextInput 
            keyboardType={"numeric"}
            placeholder="Enter 1st Number" 
            onChangeText={num1 =&gt; this.setState({num1})}/&gt;
  
          &lt;TextInput 
            keyboardType={"numeric"}
            placeholder="Enter 2nd Number" 
            onChangeText={num2 =&gt; this.setState({num2})}/&gt;
          &lt;Button title="ADD" onPress={this.addBtnPressed}/&gt;
           &lt;Text&gt;{this.state.result}&lt;/Text&gt;
        &lt;/View&gt;
      );
    }
  }
  
  const styles = StyleSheet.create({
    container: {
      flex: 1,
      justifyContent: 'center',
      paddingTop: Constants.statusBarHeight,
      backgroundColor: '#ecf0f1',
      padding: 8,
    },
  });
  </code></pre>