0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-30 00:12:56 +00:00

refactor useEffect for updating currentPage state

The current page and the current page input share the same value, so the useEffect hook can be simplified.
This commit is contained in:
Gazook89
2024-08-19 22:34:32 -05:00
parent 7fa9b3cdd2
commit 54b11b1a4c

View File

@@ -16,12 +16,8 @@ const ToolBar = ({ onZoomChange, currentPage, onPageChange, totalPages })=>{
}, [zoomLevel]);
useEffect(()=>{
setState((prevState)=>({
...prevState,
currentPage : currentPage,
pageNumberInput : currentPage,
}));
}, [currentPage]);
setPageInput(currentPage);
}, [currentPage])
const handleZoomChange = (delta)=>{
const zoomChange = _.clamp(zoomLevel + delta, minZoom, maxZoom);