windmill-react-ui
windmill-react-ui copied to clipboard
onChange function on pagination component shouldn't be ejecuted on the firtst render.
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.
https://github.com/estevanmaito/windmill-react-ui/blob/fba3fb0cfae5fac52f195b03d3fc010084908256/src/Pagination.tsx#L158