Hola Mundo!
So this is my first coding post and am really excited about it š©āš¤āØ
Thing is that, when I was creating my Portfolio I de...
For further actions, you may consider blocking this person and/or reporting abuse
Really nice post :)
One thing - your
useEffect(()=>window.addListener(...
is being called on every re-render so you will end up with lots of them added. You should return a function to remove the listener so it tidies up and possibly rewrite things a bit so you can actually only do it on mount/unmount with deps of[]
. Care needs to be taken with that though because the you need to be sure that the handler can work in cases when it wasn't added on the same render (it's a closure on the time the deps change).Thank you very much Mike, I'll put at eye on it and see if I find a solution so it works in every scenario!
useEffect(() => {
window.addEventListener("scroll", handleVisibleButton);
},[]);
For fix issue this way is great
execute when component mounting
One listener
what about removing the listener when unmouning,
This (I think) more shorter and in one component
No styles info, because it is very hard to qick-understand.
You can Use youre beatiful style.
///////////////////////////////////////////////////
import React, { useEffect, useState } from 'react'
import styles from './go-top-button.module.scss'
const GoTopButton = () => {
}
export default GoTopButton
Thank you so much both! @silviaespanagil @ottovector
Thank you so much for this post because I'm already working on this for my personal portfolio š¤š @silviaespanagil
Thank you Chetan, I hope it helps you and that you show us your finished portfolio!
Most welcome and yes definitely.
Where I'm connect with you for conversation? @silviaespanagil
Hi Chetan, I just send a connect invitation vĆa LinkedIn
ok thanks i will check
Nice little feature
I joined here, to encourage you. As you are very excited about your first post. That's a nice post. Keep it up āŗļø
Thank you very much Sajidur!
Nice
Thanks