Skip to content

Releases: bpetermann/use-sort-cities-by-distance

v.1.0.8

29 Aug 17:45
Compare
Choose a tag to compare

GetDistanceMatrix added to GoogleMaps Class to allow calculation of distances in travel distance

v.1.0.7

20 Aug 08:08
Compare
Choose a tag to compare

Refactor google maps helper class as singleton to avoid unnecessary API requests

v.1.0.6

07 Aug 17:48
Compare
Choose a tag to compare

Improving error logging for the latest release. Error messages now provide more detailed information through an object structure.

type LocationError = {
  hasError: boolean
  message: string
}

Example usage:

  const { error } = useSortCitiesByDistance(config)

v.1.0.5

04 Aug 20:16
Compare
Choose a tag to compare

The default unit of measurement is miles, if you need km you can specify it as follows:

  const [config, setConfig] = useState({
    list: cities, 
    start: 'London', 
    targets: ['London', 'Paris', 'New York', 'Barcelona'], 
    unit: 'km', 
  })

  const { sorted } = useSortCitiesByDistance(config)
}