TransitLayer component renders a transit layer on the map, showing public transportation routes, stops, and stations.
Import
Props
Callback invoked when the transit layer instance is loaded and ready.Parameters:
transitLayer: The Google Maps TransitLayer instance
Callback invoked when the transit layer is unmounted and removed from the map.Parameters:
transitLayer: The Google Maps TransitLayer instance being unmounted
Component Variants
This component is available in two variants:TransitLayer- The default memoized componentTransitLayerF- The functional component variant (same implementation)
Usage Example
Notes
- The transit layer displays metro lines, train routes, bus routes, and transit stations
- This component does not accept an
optionsprop as there are no configurable options for the transit layer - The component returns
nulland does not render any DOM elements - The transit layer is automatically removed when the component unmounts
- Transit data availability varies by region and city