Skip to content

Suggestion: refactor componentDidMount() to remove setTimeout() #12

@tomduggan85

Description

@tomduggan85

setTimeout(() => {

I think it would be a better architecture if, instead of using setTimeout() to call getData after the latitude and longitude are in state, you moved all of the code inside setTimeout inside showPosition (or a helper function that showPosition) calls. Then you are guaranteed to have the lat and long values, instead of hoping that your setTimeout waits long enough.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions