istarkov / google-map-clustering-example

clustering example for google-map-react
http://istarkov.github.io/google-map-clustering-example/
200 stars 76 forks source link

Passing props to <GMap > component #9

Closed aylabyuk closed 7 years ago

aylabyuk commented 7 years ago

I understand you can change markers using

withState(
    'markers',
    'setMarkers',
    markersData
  ),

but is it also possible to use the usual way of passing props to set the markers? <Gmap markers={markers} />

istarkov commented 7 years ago

I don't understand your question.

kunokdev commented 7 years ago

He asks if it's possible to pass data to the component by adding prop 'markers' to the component in render method where he initialized it.

For example


class App extends React.Component {
  constructor(props){
    super(props)
    this.state = { markers: [] }
  }

  render(){
    return (<div>
      <Gmap markers={this.state.markers} />
      </div>
    )
  }

}