title: Concatenate an input argument into a splice call
body: <p>I am trying to reproduce the code lines:</p>
  
  <pre><code>purchase = () =&gt; {
      const eventDetails = {...this.state.events.event0002};
  }
  </code></pre>
  
  <p>With the following, that takes "eventID" as an input (which at some point could have a value of "event0002") and adds it to "....state.events." to create "...state.events.eventID".</p>
  
  <pre><code>purchase = (eventID) =&gt; {
      const eventDetails = {`...this.state.events. $(eventID)`};
  }
  </code></pre>
  
  <p>Within an Event Handler, I am attempting to incorporate an input argument into a code line that performs the splice function.</p>
  
  <p>More specifically, I am attempting to replace "purchaseHandler1" and "purchaseHandler2" with a single Event Handler called "purchaseHandlerAll" which receives the "eventID" argument.</p>
  
  <p>In all the Event Handlers I want "eventDetails" to be eventually assigned to the "events.activeEvent" state variable.</p>
  
  <p>The code below successfully performs this assignement in the "purchseHandler1" and "purchseHandler2 Event Handlers, but does not in "purchaseHandlerAll".</p>
  
  <pre><code>    state = {
          events: {
              event0001: {
                  eventID: "0001",
                  eventName: "Rock Concert",
              },
              event0002: {
                  eventID: "0002",
                  eventName: "Dinner",
              },
              activeEvent: {
                  eventID: "",
                  eventName: ""
              }
          }
      };
  
      showPurchaseWindowHandler1 = () =&gt; {
          const allEvents = {...this.state.events};
          const eventDetails = {...this.state.events.event0001};
          allEvents.activeEvent = eventDetails;
          this.setState({events: allEvents})
      }
  
      showPurchaseWindowHandler2 = () =&gt; {
          const allEvents = {...this.state.events};
          const eventDetails = {...this.state.events.event0002};
          allEvents.activeEvent = eventDetails;
          this.setState({events: allEvents})
      }
  
      showPurchaseWindowHandlerAll = (eventID) =&gt; {
          const allEvents = {...this.state.events};
          const eventDetails = {`...this.state.events. $(eventID)`};
          allEvents.activeEvent = eventDetails;
          this.setState({events: allEvents})
      }
  render () {
      return (
          &lt;div&gt;   
              &lt;h3 close={this.purchaseHandler1}&gt;&lt;/h3&gt;
  
              &lt;h3 close={this.purchaseHandler2}&gt;&lt;/h3&gt;
  
              &lt;h3
                  eventID={this.state.events.event0001.eventID}
                  close={(eventID) =&gt; purchaseHandlerAll(eventID)}&gt;
              &lt;/h3&gt;
              &lt;h3
                  eventID={this.state.events.event0002.eventID}
                  close={(eventID) =&gt; purchaseHandlerAll(eventID)}&gt;
              &lt;/h3&gt;
  
          &lt;/div&gt;
      )
  }
  </code></pre>
  
  <p>Any help would be greatly appreciated. Thanks.</p>