如何在React hook..useEffect中重新呈现子组件

时间:2019-10-28 04:33:58

标签: reactjs

我该如何使用从父母那里获取的useeffect地理值来重新呈现它?

import React from 'react'
import { compose } from 'recompose'
import { withGoogleMap, GoogleMap as ReactGoogleMap } from 'react-google-maps'

import Marker from './Marker'

const GoogleMap = compose(withGoogleMap)(({ geo }) => {
  console.log(geo)
  return (
    <ReactGoogleMap
      center={{ lat: geo.latitude, lng: geo.longitude }}
      options={{
        streetViewControl: false,
        fullscreenControl: false,
        gestureHandling: 'cooperative',
        zoom: 18,
      }}
    >
      <Marker loc={geo} />
    </ReactGoogleMap>
  )
})

export default GoogleMap

0 个答案:

没有答案