mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2025-12-25 07:32:41 +00:00
rearrange state declarations for pages
totalPages shouldn't need to be in state, since this component won't be changing it. renamed pageNumberInput to just pageInput. Was just something that happened in the course of working on it. currentPage doesn't need to have it's own state separate from pageInput, they should always be the same *value*.
This commit is contained in:
@@ -7,13 +7,9 @@ const MAX_ZOOM = 300;
|
||||
const MIN_ZOOM = 10;
|
||||
|
||||
const ToolBar = ({ onZoomChange, currentPage, onPageChange, totalPages })=>{
|
||||
const [state, setState] = useState({
|
||||
currentPage : currentPage,
|
||||
totalPages : totalPages,
|
||||
pageNumberInput : currentPage,
|
||||
});
|
||||
|
||||
const [zoomLevel, setZoomLevel] = useState(100);
|
||||
const [pageInput, setPageInput] = useState(currentPage);
|
||||
|
||||
useEffect(()=>{
|
||||
onZoomChange(zoomLevel);
|
||||
|
||||
Reference in New Issue
Block a user