You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
put computeMagneticTarget nested function definition as a callback for React's useEffect hook, so that it is only redefined when one of the dependencies change, that is either of the variables magneticBoundaryDeadzone or magneticRadius change between renders.
loucadufault
changed the title
Optimize function definition
Optimize computeMagneticTarget function definition to prevent unecessary re-definitions
Sep 14, 2021
loucadufault
changed the title
Optimize computeMagneticTarget function definition to prevent unecessary re-definitions
Optimize computeMagneticTarget function definition to prevent unecessary re-definitions with React's useEffect hook
Sep 14, 2021
put
computeMagneticTarget
nested function definition as a callback for React'suseEffect
hook, so that it is only redefined when one of the dependencies change, that is either of the variablesmagneticBoundaryDeadzone
ormagneticRadius
change between renders.This is for optimization reasons only.
see https://github.com/loucadufault/MagneticSlider/blob/main/MagneticSlider.js#L36
The text was updated successfully, but these errors were encountered: