Can someone explain why this code returns the same value in the two logs?
Visually the change is applied.
console.log(refer.current.scrollLeft);
refer.current.scrollLeft = scrollOffset;
console.log(refer.current.scrollLeft);
CodePudding user response:
If the element the ref is attached to has scrollBehavior: smooth
applied to it then the value doesn't update instantaneously.