title: How to get the prop of another component
body: <p>I am new to React and I have Googled around but can't figure out how to do what I want to do.</p>
  
  <p>I would like to style a header link differently based on what page I am on. I am wondering how (or if it is possible) to get the prop of another component. </p>
  
  <p><br></p>
  
  <p>My code so far: </p>
  
  <pre><code>class Header extends React.Component {
  
      getClass() {
          console.log(this.props.currentPage) // Prints the correct value
          let headerType = "h2";
          if (this.props.currentPage === /*Prop of current Link*/){
              headerType = "h1"
          }
          return ("header-links " + headerType);
      }
  
      render() {
          return (
              &lt;Link to="/" page_name="Home" className={this.getClass()}&gt;Home&lt;/Link&gt;
              &lt;Link to="/About" page_name="About" className={this.getClass()}&gt;About&lt;/Link&gt;
              &lt;Link to="/Other" page_name="Other" className={this.getClass()}&gt;Other&lt;/Link&gt;               
          );
      }
  }
  </code></pre>
  
  <p>Is there some way to get the <code>page_name</code> of the <code>Link</code> that is calling <code>getClass()</code>?</p>
  
  <p><br></p>
  
  <p>I know I could just pass the name of the page into <code>getClass()</code>:</p>
  
  <pre><code>&lt;Link to="/" className={this.getClass("Home")}&gt;Home&lt;/Link&gt;
  </code></pre>
  
  <p>But I figure there must be a better way.</p>
  
  <p><br></p>
  
  <p>I'm sure I could get it using vanilla JavaScript (and maybe that is what I should be doing)... but I would like to know if there is a way to accomplish this with <code>Link</code>'s props or something similar.</p>
  
  <p><br></p>
  
  <p><strong>UPDATE</strong>
  My <code>Route</code>'s</p>
  
  <pre><code>&lt;Route exact path='/' component={Home}/&gt;
  &lt;Route exact path='/About' component={About}/&gt;
  &lt;Route exact path='/Other' component={Other}/&gt;
  </code></pre>
  
  <p>I also noticed I had <em>Resume</em> as the <code>to</code> prop in the About <code>Link</code> by accident, fixed now.</p>