Don't you find built-in cursors kinda boring?🥱 Me too. So I built my own.
Let's start by adding basic styles and logic to our cursor.
.curso...
For further actions, you may consider blocking this person and/or reporting abuse
First of all, it's a great tutorial. But I have an issue working with internal navigation components, like
@reach/router
andGatsby Link
. When I hover on those links, the hovering animation is triggered. But I click on them, the hovered prop doesn't change; it remains the same throughout the app (it's supposed to change to normal). It works perfectly for original anchor elements<a></a>
. Have any ideas to fix this? Thank you for your great post!Hmm, I was unable to reproduce it for
@reach/router
Here is the sandbox: codesandbox.io/s/reach-router-curs...
Can you provide more details? 🙂
I figured out the way how to fix it. So, when I use anchor elements for navigating, the app reloads so the states reloads too. But with internal links like
@reach/router
andgatsby-link
, the app doesn't reload so the state doesn't reload as well. My solution is to use theuseLocation
hook from@reach/router
and put it in theuseEffect
's deps, like:It will update the state whenever the route is changed.
I still have no idea why your sandbox is still working. But thank you for your response. Keep up with great contents like this one!
Hey! Awesome post!
I've been wanting to learn how to do this for quite some time!
I tried this while trying a component lib called geist-ui, and I'm having trouble hiding the pointer cursor for some buttons.
Here's my code, if someone has a workarround.
github.com/HurrellT/hurrellt.portf...
Thanks a lot!
Thank you! I checked your website and you have to override
geist-ui
link and buttons styles by addingcursor: none;
I didn't use
geist-ui
before but here is a guide on how you can do it: react.geist-ui.dev/en-us/guide/themesHiya, thanks for the great tutorial. I'm having an issue with the cursor and mouseenter/mouseleave not working properly in firefox (perfect in chrome however), was wondering if you have any insight into what might be going on?
Well, I have no idea why it happens :D
As a workaround, you can try adding
mouseenter/mouseleave
events todocument.body
instead ofdocument
to fix this issueTry this:
Thank you for your comment!
This is some great stuff! I had an issue when scrolling, the cursor scrolled with the page so I used fixed instead of absolute for the cursor and clientX & clientY instead of pageX & pageY when setting the position and it seemed to sort this out. Cheers for the great content :)
Thank you!
That's a good point! Fixed it ;)
Thank you! amazing content!
Thanks, looking forward to publishing more cool stuff ;)
For me is the cursor unusable it lags the whole time, any idea why?
Can you share some code snippet, please?
Maybe it happens due to unwanted rendering loops that force heavy calculations, but I cannot say more without more details
Yeah it feels like heavy calculations are happening but I can't find the bug, I also have the code not anymore but maybe I can find time to reproduce it.