question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

This lib is ruined by the author's fetish for recompose

See original GitHub issue

In what universe is this a good way to write components?

compose(
  withProps({
    googleMapURL: "https://maps.googleapis.com/maps/api/js?key=AIzaSyC4R6AN7SmujjPUIGKdyao2Kqitzr1kiRg&v=3.exp&libraries=geometry,drawing,places",
    loadingElement: <div style={{ height: `100%` }} />,
    containerElement: <div style={{ height: `400px` }} />,
    mapElement: <div style={{ height: `100%` }} />,
  }),
  lifecycle({
    componentWillMount() {
      const refs = {}

      this.setState({
        bounds: null,
        center: {
          lat: 41.9, lng: -87.624
        },
        markers: [],
        onMapMounted: ref => {
          refs.map = ref;
        },
        onBoundsChanged: () => {
          this.setState({
            bounds: refs.map.getBounds(),
            center: refs.map.getCenter(),
          })
        },
        onSearchBoxMounted: ref => {
          refs.searchBox = ref;
        },
        onPlacesChanged: () => {
          const places = refs.searchBox.getPlaces();
          const bounds = new google.maps.LatLngBounds();

          places.forEach(place => {
            if (place.geometry.viewport) {
              bounds.union(place.geometry.viewport)
            } else {
              bounds.extend(place.geometry.location)
            }
          });
          const nextMarkers = places.map(place => ({
            position: place.geometry.location,
          }));
          const nextCenter = _.get(nextMarkers, '0.position', this.state.center);

          this.setState({
            center: nextCenter,
            markers: nextMarkers,
          });
          // refs.map.fitBounds(bounds);
        },
      })
    },
  }),
  withScriptjs,
  withGoogleMap
)(props =>
  <GoogleMap
    ref={props.onMapMounted}
    defaultZoom={15}
    center={props.center}
    onBoundsChanged={props.onBoundsChanged}
  >

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:61
  • Comments:21

github_iconTop GitHub Comments

5reactions
phillipjcommented, Nov 5, 2018

@justrossthings could you please elaborate what you’re hoping for when opening an issue like this?

5reactions
baebbcommented, Nov 2, 2018

Taken from the docs

Read more comments on GitHub >

github_iconTop Results From Across the Web

The writer's barely disguised fetish | Alien: Isolation - YouTube
What a stupid endingYes, this will be a Completely Accurate SummaryWanna play with us?Discord: https://discord.gg/e95T48YEnjoying the ...
Read more >
The Hand of the Poet: The Magical Value of Manuscripts
Libraries announce the acquisition of a famous writer's papers with the same blare of publicity that accompanies a medical breakthrough. The public.
Read more >
Dialogues between Canada and the American South
Negroes (2007), by the Canadian mixed-race writer Lawrence Hill, the son of American immigrants to Canada. Haley's particular brand of cultural na-.
Read more >
Radio, Narrative, and the New Neighborhood of the Americas ...
I bring together this new neighborhood of writers who latch on to the long legacy of sound technology's resistance to legal concepts of...
Read more >
Journal of the Short Story in English, 69
Jay Ruud studies a more recent author, Tim O'Brien, affected by the Vietnam War and ... The shock that Sun feels at the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found