i have set up state to change the color of my background
const [bgClr, setBgClr] = useState('white');
The button whose background colors needs to be changed is
<Button
onClick={AnnualHandler}
variant="outline-light"
style={{ background: {bgClr} }}>
<div
className="pt-3 pb-3 ml-3 mr-3"
style={{ background: '#f8f9fa' }}>
<h4 style={{ color: 'var(--main)' }}>
<b>$ 15</b>
</h4>
</div>
</Button>
and the handler is
const AnnualHandler = () => {
setBgClr('yellow');
console.log(bgClr);
};
But on clicking, the background color is not changing. Should useEffect be used here?
background: ${bgClr}`