Implementing Magnetic Mouse via React

Hello! Some more fun questions! I’m trying to implement this Codepen I worked on:

I’d like this to be global but I’m not sure how to implement this via React within Frontity because it’s vanilla JS and has elements like “document” that cannot be referenced here.

I don’t know much about animations but I think you can also use onMouseMove like in this example of react-spring.