feat: SW-276 Optimized code
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
import { useFormContext } from "react-hook-form"
|
||||
import { useIntl } from "react-intl"
|
||||
|
||||
import { guestsRoomsStore } from "@/stores/guests-rooms"
|
||||
import { useGuestsRoomsStore } from "@/stores/guests-rooms"
|
||||
|
||||
import { MinusIcon, PlusIcon } from "@/components/Icons"
|
||||
import Button from "@/components/TempDesignSystem/Button"
|
||||
@@ -20,8 +20,8 @@ export default function ChildSelector({ roomIndex = 0 }: ChildSelectorProps) {
|
||||
const intl = useIntl()
|
||||
const childrenLabel = intl.formatMessage({ id: "Children" })
|
||||
const { setValue } = useFormContext()
|
||||
const children = guestsRoomsStore().rooms[roomIndex].children
|
||||
const { increaseChildren, decreaseChildren, childCount } = guestsRoomsStore()
|
||||
const { children } = useGuestsRoomsStore((state) => state.rooms[roomIndex])
|
||||
const { increaseChildren, decreaseChildren } = useGuestsRoomsStore()
|
||||
|
||||
function increaseChildrenCount(roomIndex: number) {
|
||||
if (children.length < 5) {
|
||||
|
||||
Reference in New Issue
Block a user