Question: I want print the value which is entered in TextInput to console.

below is snippets from my code:

```
constructor(props) {
        super(props);
        this.state= {
            textValue: "",
        }
    }
    _textChange = (text) => {
        this.setState({
            textValue: text,
        })
        console.log(this.state.textValue);
}

```

AND:

```
<TextInput onChange={this._textChange.bind(this)}/>

```

I know that something is wrong with my code, but I am not able to figure it out. I just want to print the entered text in TextInput to be printed in console

Note
----

[I have seen this answer](https://stackoverflow.com/questions/31702861/when-value-is-assigned-to-components-state-why-console-log-prints-the-previous). I am not able to understand the answers in the given link. I am very new to react-native. So please try to explain it the simple way.

Answer: 
You should use onChangeText instead of onChange

```
<TextInput onChangeText={this._textChange}/>

```

if declare your method as a named function like below

```
    _textChange(text) {
        this.setState({
            textValue: text,
        })
     }

```

So you should use bind, because the *this* keyword will not refer to the component scope,but in your case it is not necessary.

Please take a look at [this](https://medium.com/@joespinelli_6190/using-arrow-functions-to-avoid-binding-this-in-react-5d7402eec64#:%7E:text=Arrow%20functions%20make%20your%20code,to%20use%20them%20in%20React.&text=props%20we%20need%20to%20bind,for%20the%20component%20with%20this.) article to understand difference between named function and arrow function.
You are missing something when you create a class but your error is inside the react event `onChangeText` instead of `onChange`, but I think you can avoid calling `this._textChange.bind(this)`, this is used with another type of class declaration (see below).
I like the following react class declaration, and maybe it can help to understand what is happening under the hood (if you are starting with react now)

```
class PComponern extends Component {

    constructor(props) {
        super(props);
        this.state= {
            textValue: "",
        };
       this._textChange = this._textChange.bind(this)
    }

  _textChange(text) {
    this.setState({
            textValue: text,
        });
    console.log(this.state.textValue);
  }   

  render (
    ...
    <TextInput onTextChange={this._textChange}/>
    ...
    )

}

```

This form can help you to start, but sometimes in not necessary call the `this._textChange = this._textChange.bind(this)` in the constructor, see also [this reference](https://reactjs.org/docs/faq-functions.html)

There are also a couple of comment that suggest the following things

* you may want to do this: onTextChange={this.\_textChange} instead of using onChange.

[Runnable code](https://snack.expo.io/omrggE6rh)