Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onChange function on pagination component shouldn't be ejecuted on the firtst render. #72

Open
davs20 opened this issue Jan 4, 2022 · 0 comments

Comments

@davs20
Copy link

davs20 commented Jan 4, 2022

hello @estevanmaito , im using the pagination component and I discover that onChange funtion is ejecuted on the first render, that's wrong because, onChange function only should be ejecuted when the page is changed, so, I was thinking and I found a problem in the useEffect that handle this function, the problem is that useEffect always will be ejecuted on first render , even if you don't change the state, so my proposal is create a reference using useRef , with that , useEffect will know when the component is rendered for first time.

}, [activePage])

@davs20 davs20 changed the title onChange function shouldn't be ejecuted on the firtst render. onChange function on pagination component shouldn't be ejecuted on the firtst render. Jan 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant