I'm trying to use Mapbox Geocoder without map in React (see https://docs.mapbox.com/mapbox-gl-js/example/mapbox-gl-geocoder-no-map/ ). I can successfully create a refs but once I use it as an argument in .addTo() function, I get this error message although the refs is an [object HTMLDivElement]:
Error: addTo Container must be a mapbox-gl-js map or a html element reference The code is here: https://codesandbox.io/s/patient-hill-xvh12?fontsize=14&hidenavigation=1&theme=dark