title: TypeError: undefined is not an object (evaluating 'this.state')
body: <p>I can see there's a lot of similar questions, but none of the answer could help me.</p>
  <p>I get this error when running the code below: TypeError: undefined is not an object (evaluating 'this.state')
  I also get this error, but this is connected to this.setState(): TypeError: _this.setState is not a function. (In '_this.setState({
  checked: !_this.state.checked
  })', '_this.setState' is undefined)</p>
  <pre><code>&lt;CheckBox
     center
     title='Click Here'
     checked={this.state.checked}
     onPress={() =&gt; this.setState({checked: !this.state.checked})}
  /&gt;
  </code></pre>
  <p>The whole code (if necessary):</p>
  <pre><code>export default function NewEventScreen() {
  
      const [date, setDate] = useState(new Date());
      const [mode, setMode] = useState('date');
      const [show, setShow] = useState(false);
  
      const onChange = (event, selectedDate) =&gt; {
          const currentDate = selectedDate || date;
          setShow(Platform.OS === 'ios');
          setDate(currentDate);
        };
      
        const showMode = (currentMode) =&gt; {
          setShow(true);
          setMode(currentMode);
        };
      
        const showDatepicker = () =&gt; {
          showMode('date');
        };
      
        const showTimepicker = () =&gt; {
          showMode('time');
        };
  
      handleEventCreation = () =&gt; {
          const { title, description } = this.state
          firebase.firestore()
               .collection('users').doc(firebase.auth().currentUser.uid).collection('events').doc().set({
                      title: title,
                      description: description,
                  }).then(() =&gt; { console.log(&quot;Document written&quot;) 
                      this.setState({
                          title: '',
                          description: '',
                      })
                  }).catch(error =&gt; console.log(error))
      }
  
      state = {
          title: '',
          description: '',
          checked: false,
      }
  
      onPress = () =&gt; {
          this.setState({checked: !this.state.checked})
      }
  
          return (
              &lt;View style={styles.container}&gt;
                  &lt;Text style={styles.title}&gt;Here can you make your events!&lt;/Text&gt;
                  &lt;TextInput
                      style={styles.inputBox}
                      value={state.title}
                      onChangeText={title =&gt; this.setState({ title })}
                      placeholder='Title'
                  /&gt;
                  &lt;TextInput
                      style={styles.inputBox}
                      value={state.description}
                      onChangeText={description =&gt; this.setState({ description })}
                      placeholder='Description'
                  /&gt;
                  &lt;CheckBox
                      center
                      title='Click Here'
                      checked={this.state.checked}
                      onPress={() =&gt; this.onPress()}
                  /&gt;
                  &lt;View&gt;
                      &lt;View&gt;
                          &lt;Button onPress={showDatepicker} title=&quot;Show date picker!&quot; /&gt;
                      &lt;/View&gt;
                      &lt;View&gt;
                          &lt;Button onPress={showTimepicker} title=&quot;Show time picker!&quot; /&gt;
                      &lt;/View&gt;
                          {show &amp;&amp; (
                              &lt;DateTimePicker
                              testID=&quot;dateTimePicker&quot;
                              value={date}
                              mode={mode}
                              is24Hour={true}
                              display=&quot;default&quot;
                              onChange={onChange}
                              /&gt;
                          )}
                      &lt;/View&gt;
                  &lt;TouchableOpacity style={styles.button} onPress={handleEventCreation}&gt;
                      &lt;Text style={styles.buttonText}&gt;Create Event&lt;/Text&gt;
                  &lt;/TouchableOpacity&gt;
              &lt;/View&gt;
          )
      }
  </code></pre>