title: How to redirect to a gatsby-react page with an onclick event of a component?
body: <p>I'm trying to redirect to a page using an <code>onClick</code> event of a component. As I have react gatsby installation is it possible to use <code>Link</code> from <code>gatsby-link</code> to redirect.</p>
  
  <pre><code>import React from  'react';
  import { OverflowMenu, OverflowMenuItem } from '../Overflow';
  import Link from 'gatsby-theme-carbon/src/components/Link';
  
  class  OverflowComponent extends React.Component {
  
  editPage(index) {
    console.log();
    // window.location.href='/edit';
    return(
      &lt;Link to="/edit"&gt;&lt;/Link&gt; // I'm trying to redirect to Edit page
    )
  }
  
  deletePage() {
    console.log("Delete clicked");
  }
  
    render(){ 
      return (
        &lt;div&gt;
          &lt;OverflowMenu flipped={true}&gt;
              &lt;OverflowMenuItem  itemText="Edit" primaryFocus onClick={() =&gt; this.editPage()} /&gt;
              &lt;OverflowMenuItem  itemText="Delete" onClick={() =&gt; this.deletePaget()} /&gt;
          &lt;/OverflowMenu&gt;
        &lt;/div&gt;
      );
    }
  }
  
  export default OverflowComponent;
  </code></pre>
  
  <p>from the above code the <code>Overflow</code> component is a contributed component and it can have a onClick function. And I'm trying to redirect using gatsby-link.</p>