New to react and cannot find a quick answer in the many simple examples out there. Gatsby and React generate class names at run time so my class .page1
in scss ends up being sections-module--page1--2SNjF
.
What is the correct way to select an element and add an additional class to it?
import React from 'react';
import styles from '../scss/sections.module.scss';
import $ from 'jquery';
class Section extends React.Component {
componentDidMount() {
$(what??).addClass('active'); // how to select .page1 here
}
render() {
return (
<>
<section className={styles.page1}>
<h2>section 1</h2>
</section>
<section className={styles.page2}>
<h2>section 2</h2>
</section>
</>
)
}
}
export default () => (
<Section/>
)