score:1

Accepted answer

you could set a wrapper for the anchors and change the color of the wrapper instead on your scroll functionality, while setting the color of the anchors to inherit. this way the anchors will always inherit the color you set on the wrapper, even when visited.

const usestyles = makestyles((theme) => ({
  ...

  links: {
    textdecoration: 'none',
    color: 'inherit'
  },

  ...

}));

and then for the links you simply add the class:

<a href="/contact" classname={classes.links}>
  <h2 classname={classes.appbartitle2}>sales</h2>
</a>

hope this was helpful.


Related Query

More Query from same tag