I have some `reactjs` state values as below:

```
constructor(props) {
    super(props);
    this.state = {
      // demo button click
      age: "",
      dailyRate: "",
    };

```

And I am updating these two values on a button click as below and set those values to a `javascript` object as the next step as below:

```
 onDemoButtonClick() {
    this.setState({
      age: "39",
      dailyRate: "903",
    });

    // and setting those newly updated state values to a js object
    var dataframeObject = {};
    dataframeObject["Age"] = this.state.age;
    dataframeObject["DailyRate"] = this.state.dailyRate;

   // and try to print the values
   console.log(dataframeObject["Age"]) // this doesn't prin the new value
  }

```

As above I try to print the value to verify it if has really being updated, but no, it is not.
I guess this is because the `setState` function is `asynchronous`? And if so, how can I do work this out? What is the solution?