Shadow Parallax with Reactjs (codepen.io)
over 7 years ago from Siamak Mokhtari, Front–End Developer
over 7 years ago from Siamak Mokhtari, Front–End Developer
Keep in mind that, by default, React rerenders your component on state change, so keeping track of mouseX and mouseY in state could get expensive. I would recommend combining your onMouseMove and CreateShadow functions and skipping the setting of state entirely since you're really only using it to track the mouse position which you're already getting with e.pageX and e.pageY.
Any background on why you wanted to use React for this? Was there a specific benefit as opposed to just using vanilla JS?
Thanks for watch my Pen. I wanna build an app with react and I prefer to use react for this case. Everyone can Do it with Vanilla–JS but I wanna use ReactJS ;)
Got it, just curious. Thanks
Designer News
Where the design community meets.
Designer News is a large, global community of people working or interested in design and technology.
Have feedback?
Login to Comment
You'll need to log in before you can leave a comment.
LoginRegister Today
New accounts can leave comments immediately, and gain full permissions after one week.
Register now