a function that maps a region string a structure that can be used as an option in a select box. The default is to return an option element with the date format as the value and label.
KosDateFormatHookData - the data returned from the hook.
In this example the default region map is used to populate a select box with the available regions. If using a third party select box component where the options are passed in as a prop, the options property can be spread into the props for the component. In this case, a region map function could be passed in to map the region to a structure that the component expects.
interface RegionData extends RegionServices.BaseRegionResponse {
rfidRegion: string;
}
const { regionSelectProps, regionModel, regionData, selectedRegion, updateRegion } = useKosRegions<RegionData>();
const { options, ...selectAttributes } = regionSelectProps;
...
<div>
<label>Select region: </label>
<select {...selectAttributes}>{options}</select>
</div>
<div>Selected Region: {selectedRegion}</div>
<div>Region Data: {regionData?.rfidRegion}</div>
A hook that will help manage the use of region date formats on a dispenser.