In Footer.js (where I want the link to add the class set within Newsletter.js) import React from 'react' import PropTypes from 'prop-types'; import Link from 'gatsby-link' const React does not have an opinion about how styles are defined; if in doubt, a good starting point is to define your styles in a separate *.css file as usual and refer to them using className. Handle mouse down/up and click events once with React Hooks The issue. I want to add 'active' class only to element that is changes the slide (by onClick event). What you can do though is to hide an element if a checkbox is :checked Here is the HTML for the examples in this article. Create a Class Component. See React Transition Group, React Motion, React Spring, or Framer Motion, for example. The ComponentDidMount () method is the best place to set a focus on the input element. Keyboard events are only generated by