2017-05-22 9 views

答えて

1

最近、React RefsLeaflet APIを使用してこの問題を解決しました。

ベアボーン例:

import React, { Component } from 'react'; 

import { Circle } from 'react-leaflet'; 

class Foo extends Component { 
    render() { 
     const { center, radius } = this.props; 
     return (
      <Circle 
       ref={circle => { this.circle = circle; }} 
       center={center} 
       radius={radius} 
       onMouseOver={() => { 
        this.circle.leafletElement.bindPopup('foo').openPopup(); 
       }}/> 
     ); 
    } 
} 

export default Foo; 
関連する問題