If I understand your requirement right, when the values in availableCities changes, you want the changed values to be reflected in the dropdown, right?
For this to work, you will need the component to re-render when the availableCities changes.
In React, re-rendering happens in the following scenarios:
State Changes: If the state of a component changes with the setState function (in class components) or the state updating function from a useState hook (in functional components), the component will re-render. Use useState to manipulate the value of availableCities. (Recommended approach)
Props Changes: If a parent component passes different props to a child component, the child component will re-render. Pass availableCities via props.
Force Update: If the forceUpdate method is called (in class components), the component will re-render. Call forceUpdate after updating the availableCities. (Not recommended)
Parent Re-renders: If a parent component re-renders, its child components will also re-render by default. However, this can be optimized with techniques like shouldComponentUpdate, React.memo, or React.PureComponent.
Hooks Dependency Changes: If a component uses a hook like useEffect, useMemo, or useCallback with a dependency array, and one of the dependencies changes, the component will re-render.