mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-11-23 01:26:58 +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:
1 parent
7fa9b3cdd2
commit
54b11b1a4c
1 file changed
+2
-6
@@ -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