title: How to set state of a react component with a specific item from a returned json object?
body: <p>This is a follow up question to the previous thread</p>
  
  <p><a href="https://stackoverflow.com/questions/53737568/how-to-return-json-data-to-a-react-state">How to return json data to a react state?</a></p>
  
  <p>My react component makes an <code>axios.post</code> to an <code>express</code> server. The server uses <code>web3</code> to sign a transaction onto <code>Ethereum</code>. <code>Ethereum</code> returns the following <code>json</code> object. Of note is that it takes some time (seconds to minutes depending on the miners) for the <code>json</code> to be returned:</p>
  
  <pre><code>{ blockHash: '0xcd08039bac40e2865886e8f707ce9b901978c339d3abb81516787b0357f53fbd',
    blockNumber: 4611028,
   ...other data...
    transactionHash: '0x12c65523743ed169c764553ed2e0fb2af1710bb20a41b390276ffc2d5923c6a9',
    transactionIndex: 1 }
  </code></pre>
  
  <p>Here is the code I am using to make the <code>axios.post</code> and set the state:</p>
  
  <pre><code>import React from "react";
  import PaypalExpressBtn from "react-paypal-express-checkout";
  import axios from "axios";
  
  export default class Pay extends React.Component {
  
  constructor(props) {
   super(props);
   this.state = {
    items: {}
    };
   }
  
    render() {
      const onSuccess = payment =&gt; {
        axios
          .post("http://compute.amazonaws.com:3000/", {
            value: this.props.value,
            fileName: this.props.fileName,
            hash: this.props.hash
          })
          .then(response =&gt; console.log(response.data))
          .catch(function(error) {
            console.log(error);
          });
  
        console.log(payment);
      };
  
      let env = "sandbox"; // you can set here to 'production' for production
      let currency = "USD"; // or you can set this value from your props or state
      let total = 3.33; // same as above, this is the total amount (based on 
  
      const client = {
        sandbox:
          "...key...",
        production: "YOUR-PRODUCTION-APP-ID"
      };
  
      return (
        &lt;div&gt;
          &lt;PaypalExpressBtn
            onSuccess={onSuccess}
          /&gt;
        &lt;/div&gt;
      );
    }
  }
  </code></pre>
  
  <p>When I <code>console.log({ items: this.state.items})</code> I am returned a seemingly endless array of contructors and props.</p>
  
  <p>I have tried </p>
  
  <p><code>this.setState({ items : items.transactionHash });</code> and <code>console.log(
          { items: this.state.items.transactionHash})</code>, neither worked.</p>
  
  <p>What I need to do is <code>set.state</code> with only the <code>transactionHash</code> from the above json and nothing else. </p>
  
  <p>Thanks much!</p>