thank you for checking out my question!
I have a color that the customer has selected.
The color has full app context. so far every item that I wish to change the backgroundColor of will change to the { color }. This is done very simply like so:
<div className='navbar' style={{ background: color }}>
I want to perform the same thing but only change the background color on hover.
I kind of have an idea in my head about how to perform it using vanilla JS, so I'm uncertain about how to perform it within a React application. Here's what I've conjured up:
export default function RecipeList( {recipes} ) {
const hoverColorItems = document.querySelectorAll('.hoverColor');
hoverColorItems.forEach((item) => {
item.addEventListener("onFocus", function() {
item.style.backgroundColor = { color }
})
})
return (
<>
<Link className="hoverColor">Button</Link>
</>
)
}
Of course, I don't expect the forEach and querySelector onFocus to work... I'm just using it for reference to get my idea across since its much more familiar to me.
Thanks!