@@ -30,27 +30,29 @@ const useDirections = (props: DirectionsProps = {}): DirectionsHookReturns => {
3030 const { map, loading} = useGoogleMap ( ) ;
3131
3232 // Creates a Directions Service instance
33- const directionsService = useMemo < google . maps . DirectionsService | null > ( ( ) => {
34- // Wait for map to be initialized
35- if ( ! map || loading ) {
36- return null ;
37- }
33+ const directionsService =
34+ useMemo < google . maps . DirectionsService | null > ( ( ) => {
35+ // Wait for map to be initialized
36+ if ( ! map || loading ) {
37+ return null ;
38+ }
3839
39- return new google . maps . DirectionsService ( ) ;
40- } , [ map , loading ] ) ;
40+ return new google . maps . DirectionsService ( ) ;
41+ } , [ map , loading ] ) ;
4142
4243 // Creates a Directions Renderer instance
43- const directionsRenderer = useMemo < google . maps . DirectionsRenderer | null > ( ( ) => {
44- // Wait for map to be initialized
45- if ( ! map || ! renderOnMap ) {
46- return null ;
47- }
48-
49- const renderer = new google . maps . DirectionsRenderer ( renderOptions ) ;
50- renderer . setMap ( map ) ;
51-
52- return renderer ;
53- } , [ map , renderOnMap ] ) ;
44+ const directionsRenderer =
45+ useMemo < google . maps . DirectionsRenderer | null > ( ( ) => {
46+ // Wait for map to be initialized
47+ if ( ! map || ! renderOnMap ) {
48+ return null ;
49+ }
50+
51+ const renderer = new google . maps . DirectionsRenderer ( renderOptions ) ;
52+ renderer . setMap ( map ) ;
53+
54+ return renderer ;
55+ } , [ map , renderOnMap ] ) ;
5456
5557 // Updates the directions renderer options
5658 useEffect ( ( ) => {
0 commit comments