Guest count functionality like in Air Bnb

How to make guest count functionality like Air bnb??

There are several ways to do this, one approach would be to use custom state of type number (at the page level or in the group of guest types), so each time the “+” icon is clicked you plus 1 to the current value of custom state, and decreases the custom state by 1 when the “-” icon is clicked.

At the top you just display the current value of the custom state that will refer to the amount of current guests and when the “x” icon is clicked you reset the value of the custm state and the groups of guests.

Thanks man it worked out, :100: But now! How to get results from listings?
air bnb solved

Did you create a custom state for each guest type?

How will you work with the number of these guests? Will you need to use them separately or will it be the sum of them all, without type differentiation?

If it’s separately and you’ve created separate custom states, just reference them separately.

If there is no need for type separation, then there is no need for multiple custom states, only one.

But if you’re going to use them as filter options, let’s say you need to filter places that accept 2 pets, keep them separate.

yes, I created multiples custom states and display on same text group in search bar. but I’m curious how to deal in DB? Like how all the custom states act as filters in listings and display the filtered results.


?

This topic was automatically closed after 70 days. New replies are no longer allowed.