Question: I have been trying to solve a particular question in my own amateur way from the Python 3 Bootcamp on Udemy. So far, there is an error, I guess, in the append() line of my [python](/questions/tagged/python "show questions tagged 'python'") code. Here I have provided you with the question and the answer to be expected. Please help me find out the error in my code.

> 
> MASTER YODA: Given a sentence, return a sentence with the words
> reversed master\_yoda('I am home') --> 'home am I' master\_yoda('We are
> ready') --> 'ready are We'
> 
> 
> 

```
def master_yoda(text):
        mylist=[text.split()]
        print(mylist)
        newlist=[]
        index=-1
        for x in mylist:
            newlist.append(mylist[index])
            index=index+1
        for y in newlist:
            print(" ".join(y))

```

Answer: 
You have forgot to `bind` this with you function and calling it on constructor of your component.

So when in your `handleCheckBox` you are passing `this` so `this` does not have `target` property so it will return undefined.

```
this.handleCheckBox = this.handleCheckBox(this) // issue is here 

```

To solve this `bind` function as below:-

```
this.handleCheckBox = this.handleCheckBox.bind(this)

```
In React v16 (and older), the `event` object doesn't hang around after the function returns. Remember that React state updates are asynchronous, and so the event object has likely been nullified and returned back to the event pool\*. Save the `checked` value *before* enqueueing the state update. You are also missing the `this` binding in the constructor, either fix that or convert to arrow function so `this` of the class is bound automatically.

```
handleCheckBox = (event) => {
  const { checked } = event.target;
  this.setState({
    full_time: checked,
  });
}

```

\* Note: This is no longer the case in React v17.

[Events](https://reactjs.org/docs/events.html)

> 
> Note:
> 
> 
> As of v17, `e.persist()` doesn’t do anything because the `SyntheticEvent`
> is no longer [pooled](https://reactjs.org/docs/legacy-event-pooling.html).
> 
> 
>