title: Changing active video in React
body: <p>I have a video player and a sidebar of other videos to play. I want to be able to to click a video from the sidebar and display it on the video player, replacing the default video, and remove it from the sidebar, putting the replaced video in its place. (The videos are currently just posters as there's no actual video source yet).</p>
  <p>Currently, I've set the default video to index 0 from my JSON, and I've set a state that is connected to the sidebar which displays all the videos.</p>
  <p>I believe I can use an event listener that takes the id (or index as that's what's being used to display the default video) of the clicked video and uses it to update the active video via the state. However, I'm not sure how to implement this and then hide the active video from the sidebar.</p>
  <p>App.js:</p>
  <pre><code>class App extends Component {
    state = {
      videos: videos,
      activeVideo: videos[0],
    };
  
    render(props) {
      return (
        &lt;&gt;
          &lt;Header /&gt;
          &lt;VideoPlayer activeVideo={this.state.activeVideo} /&gt;
          &lt;LowerSection videos={this.state.videos} /&gt;
        &lt;/&gt;
      );
    }
  }
  </code></pre>
  <p>Video Sidebar:</p>
  <pre><code>const NextVideo = (props) =&gt; {
    const videos = props.videos;
    return (
      &lt;section className=&quot;nextVideosSection&quot;&gt;
        &lt;div className=&quot;nextVideosSection__content&quot;&gt;
          {videos.map((data) =&gt; {
            return (
              &lt;&gt;
                &lt;div className=&quot;nextVideosSection__image&quot;&gt;
                  &lt;img
                    className=&quot;nextVideosSection__thumbnail&quot;
                    src={data.image}
                    alt=&quot;thumbnail&quot;
                  /&gt;{&quot; &quot;}
                &lt;/div&gt;
                &lt;div className=&quot;nextVideosSection__text&quot;&gt;
                  &lt;p className=&quot;nextVideosSection__videoTitle&quot;&gt;{data.title}&lt;/p&gt;
                  &lt;p className=&quot;nextVideosSection__videoChannel&quot;&gt;
                    {data.channel}
                  &lt;/p&gt;
                &lt;/div&gt;
              &lt;/&gt;
            );
          })}
        &lt;/div&gt;
      &lt;/section&gt;
    );
  };
  </code></pre>
  <p>JSON format:</p>
  <pre><code>{
      &quot;id&quot;: &quot;someID&quot;,
      &quot;title&quot;: &quot;someTitle&quot;,
      &quot;channel&quot;: &quot;someChannel&quot;,
      &quot;image&quot;: &quot;someImage.jpg&quot;      //This is used for the video player poster
    },,,
  </code></pre>