
Security News
The Next Open Source Security Race: Triage at Machine Speed
Claude Opus 4.6 has uncovered more than 500 open source vulnerabilities, raising new considerations for disclosure, triage, and patching at scale.
react-mapbox-gl-geocoder
Advanced tools
Simple react autocomplete for geocoding locations using [Mapbox API](https://www.mapbox.com/api-documentation/?language=JavaScript#introduction). You can use it with [react-map-gl](https://github.com/uber/react-map-gl) to pan to found locations.
Simple react autocomplete for geocoding locations using Mapbox API. You can use it with react-map-gl to pan to found locations.
npm install --save react-mapbox-gl-geocoder
# or
yarn add react-mapbox-gl-geocoder
import React, {Component} from 'react'
import Geocoder from 'react-mapbox-gl-geocoder'
import ReactMapGL from 'react-map-gl'
import './index.css'
const mapAccess = {
mapboxApiAccessToken: process.env.REACT_APP_MAPBOX_API_ACCESS_TOKEN
}
const mapStyle = {
width: '100%',
height: 600
}
const queryParams = {
country: 'us'
}
class App extends Component {
state = {
viewport: {}
}
onSelected = (viewport, item) => {
this.setState({viewport});
console.log('Selected: ', item)
}
render() {
const {viewport} = this.state
return (
<div>
<Geocoder
{...mapAccess} onSelected={this.onSelected} viewport={viewport} hideOnSelect={true}
queryParams={queryParams}
/>
<ReactMapGL
{...mapAccess} {...viewport} {...mapStyle}
onViewportChange={(newViewport) => this.setState({viewport: newViewport})}
/>
</div>
)
}
}
| Name | Type | Description | Default |
|---|---|---|---|
| mapboxApiAccessToken | (required) string | Mapbox Access Token | - |
| timeout | int | Debounce between pressing the key and quering the results | 300 |
| viewport | object | Map Viewport | - |
| onSelected | (required) function(viewport, item) | Receives selected item and the viewport to set for the selected item | - |
| transitionDuration | int | Duration of the smooth transition | 0 |
| hideOnSelect | bool | Whether to hide results on select or not | false |
| pointZoom | int | Zoom to set if a specific location (without bbox) is selected | 16 |
| formatItem | function(item) | Function used for formatting results | item => item.place_name |
| className | string | Class to add to the top component | - |
| queryParams | object | Query parameters to use when searching of the results, you can see available options here | - |
| limit | int | Limit of the results | 5 |
| localGeocoder | function(queryString) | Function to supplement local results to geocoder | - |
This component does NOT come with any styles. You can style it yourself by using classes:
| Class name | Description |
|---|---|
| .react-geocoder | component wrapper class |
| .react-geocoder-results | results wrapper class |
| .react-geocoder-item | single result class |
You can even supplement your own components:
| Property name | Passed Properties | Properties description |
|---|---|---|
| inputComponent | onChange | Function to call when the text changes |
| itemComponent | item, onClick, children | children is item formatted to display |
MIT © groinder
FAQs
Simple react autocomplete for geocoding locations using [Mapbox API](https://www.mapbox.com/api-documentation/?language=JavaScript#introduction). You can use it with [react-map-gl](https://github.com/uber/react-map-gl) to pan to found locations.
We found that react-mapbox-gl-geocoder demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Claude Opus 4.6 has uncovered more than 500 open source vulnerabilities, raising new considerations for disclosure, triage, and patching at scale.

Research
/Security News
Malicious dYdX client packages were published to npm and PyPI after a maintainer compromise, enabling wallet credential theft and remote code execution.

Security News
gem.coop is testing registry-level dependency cooldowns to limit exposure during the brief window when malicious gems are most likely to spread.