Hello, I am newbie and start learning Android mobile programming using react native.. I encounter a problem using setState state, it's keep show an error : "Can't find variable : setState"

import React, { Component } from 'react';
import {
} from 'react-native';

export default class WeatherProject extends Component {
  constructor(props) {
    super (props)
  render () {
    return (
      <View> <Text onPress={() => setState({text: ' Native'})}>{this.
          props.setState +" "+ this.state.appendText}</Text> </View>

AppRegistry.registerComponent('WeatherProject', () => WeatherProject);

Could someone pointed where is the problem in the code?

use this.setState() instead of setState().
Never use setState() directly without this.

Ex. this.setState({ text :'Native' })

use this.setState() instead of setState().

commented: This just repeats an earlier answer -3

What language do you use?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.