- Show user location on map
- Show nearby cars
- Update car positions in real time
- Animate movement smoothly
- Show route from pickup to destination
- How do you handle frequent updates?
- How do you animate movement?
- How do you avoid re-rendering everything?
- How do you handle thousands of cars?
- How do you cluster markers?
- UI Layer (Map + Markers)
- Data Model (Location data)
- Real-time Updates
- Animation System
- Rendering Optimization
- Caching
- Edge Cases
- Map (Google Maps / Mapbox)
- User marker
- Driver markers
- Route polyline
- Pan / zoom
- Marker updates
- Route visualization

{
id: "driver1",
lat: 12.9716,
lng: 77.5946,
heading: 120
}- WebSocket (preferred)
- Polling (fallback)
- Server sends location updates
- Client updates state
- UI re-renders

- Markers jumping looks bad
- Interpolate positions
- Old position → New position
- Animate over 300–500ms

- Store previous position
- Interpolate frame-by-frame
- Use requestAnimationFrame
- Avoid full re-render
- Update only changed markers
- Use map libraries’ native marker system
- Marker clustering
- Viewport-based rendering
- Only render visible cars
- Show count
- Expand on zoom
- Cache last known positions
- Avoid refetching same region
- Throttle updates
- Batch updates
- Use Web Workers (advanced)
- Avoid React re-render loops
- Network delay
- Sudden jumps in location
- GPS inaccuracies
- Rapid zoom changes
- Load map
- Fetch nearby drivers
- Start real-time updates
- Animate movement
- Update UI
- Real-time thinking
- Performance awareness
- Animation understanding
- Efficient rendering












