On my website i have a mobile menu thats state is toggled by a useState hook. Its initial value is set to false. When false it gets applied a class of just "sidebar". When it is true it gets a class of "sidebar sidebar--active". Everything works fine when preview mode is not active, but when it is active no classes get applied to my div. This issue also only occurs on my production (netlify) link, with my local preview i experience no issues.
import React from "react"
import { Link } from "gatsby"
import navbarLinks from "../../constants/navbarLinks"
import { FaTimes } from "react-icons/fa"
import SocialIcons from "../SocialIcons"
const Sidebar = ({ navbarActive, setNavbarActive }) => {
return (
<div className={navbarActive ? "sidebar sidebar--active" : "sidebar"}>
<button
type="button"
className="sidebar__toggle"
onClick={() => {
setNavbarActive(false)
}}
>
<FaTimes />
</button>
<div className="sidebar__list mb-3">
{navbarLinks.map(link => {
const { url, text } = link
return (
<li className="sidebar__list-item" key={url}>
<Link
to={url}
activeClassName="sidebar__list-link--active"
className="sidebar__list-link"
onClick={() => {
setNavbarActive(false)
}}
>
{text}
</Link>
</li>
)
})}
</div>
<SocialIcons />
</div>
)
}
export default Sidebar