Check out example codes for "gatsby link active". It will help you in understanding the concepts better.

Code Example 1

<Link to="/"  activeClassName="link__active" />

<style>
.link__active {
      color: #b100c2;
    }
</style>

Learn ReactJs, React Native from akashmittal.com