title: Simplify setting values of object using key
body: <p>Is there any way to simplify the following code? May be by using underscore js, I went through the docs, but could not find anything which helps me solve with dynamic key value pair.</p>
  
  <p>Object : </p>
  
  <pre><code>this.state = {
          media : {
              video : "",
              photos : [{
                  title : "Storefront",
                  url : "https://cdn.filepicker.io/api/file/cHyLd9KtSNibpsGlQsny",
                  category : {
                      interior : false,
                      exterior : true,
                      closeup : false
                  },
                  display : {
                      preview : false,
                      featured : true,
                      none : false
                  },
                  size : "800 x 600",
                  attribution_link : "",
                  attribution_text : "",
                  description : ""
              },
              {
                  ...
              }]
         }
  }
  </code></pre>
  
  <p>I'm using react, while handleDisplayClick(e) method is being called, the e will be having the key name, I need to update it to true, and the remaining to false.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>handleDisplayClick = (e) =&gt; {
          var stateCopy = Object.assign({}, this.state);
          if(e == "preview"){
              stateCopy.media.photos[this.state.media.selectedMediaIndex].display.preview = true;
              stateCopy.media.photos[this.state.media.selectedMediaIndex].display.featured = false;
              stateCopy.media.photos[this.state.media.selectedMediaIndex].display.none = false;
          }
          else if(e == "featured"){
              stateCopy.media.photos[this.state.media.selectedMediaIndex].display.preview = false;
              stateCopy.media.photos[this.state.media.selectedMediaIndex].display.featured = true;
              stateCopy.media.photos[this.state.media.selectedMediaIndex].display.none = false;
          }
          else{
              stateCopy.media.photos[this.state.media.selectedMediaIndex].display.preview = false;
              stateCopy.media.photos[this.state.media.selectedMediaIndex].display.featured = false;
              stateCopy.media.photos[this.state.media.selectedMediaIndex].display.none = true;
          }
          this.setState(stateCopy);
      }</code></pre>
  </div>
  </div>
  </p>