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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user