I have one question. This is probably easy task but I am trying to overthink this. I have such situation:
<Button
className={favorites ? styles.active : styles.outlines}
onClick={() => addToFavorites({ id })}
variant='outline'
>
This button is adding a product as favourite. But i want to prevent page from scrolling. The addToFavorites({ id }) is passed from props. Can i do something like this:
const addFav = e => {
e.preventDefault();
};
and then
<Button
className={favorites ? styles.active : styles.outlines}
onClick={e => addToFavorites({ id }, addFav(e))}
variant='outline'
>
Right now it is workning, but not sure if this is valid solution
disabledproperty.