Reputation: 19
Working in ReactJS
I have a button that toggles a section but I want also to auto scroll to that section, I have a fixed nav so I need to also offset the scroll.
I can't make 2 calls work in side onClick:
onClick={handleClick, ()=>{ setToggle(1)}}
this way setToggle function runs but handleClick doesn't.
any help appreciated!
Upvotes: 1
Views: 28
Reputation: 2635
Try to call methods like below:-
onClick={(event) => {
handleClick(event);
setToggle(1);
}}
Upvotes: 3