Giter Site home page Giter Site logo

Comments (5)

ro-ka avatar ro-ka commented on July 18, 2024

You can already pass in values. See the readme. What else do you mean?

from react-geosuggest.

plraphael avatar plraphael commented on July 18, 2024

Here is what I think he meant:
Suppose we have a form and wants to get the address in this form with Geosuggest and suppose this form also performs uptades. This means that we would need to initialize Geosuggest with the address we got from it already when the user filled in the form to insert...
Now, the question: is there a way for us to initialize the input of Geosuggest right now? If there is, I think it is not in the docs...

I have modified the code of your Geosuggest for my need, to include a prop named "defaultValue" and the new getInitialState goes something like this:

/**
   * Get the initial state
   * @return {Object} The state
   */
  getInitialState: function() {
    return {
      isSuggestsHidden: true,
      userInput: this.props.defaultValue,
      activeSuggest: null,
      suggests: [],
      geocoder: new google.maps.Geocoder(),
      autocompleteService: new google.maps.places.AutocompleteService()
    };
  },

What do you think ro-ka? Am I missing something terrible here? :)

Thanks

ps: the only modification I did to getInitialState is the initial value of "userInput" to be the new prop

from react-geosuggest.

ro-ka avatar ro-ka commented on July 18, 2024

Thanks for the feedback –sounds useful! Will think about the implementation and look at it next week. Planning to include this.

from react-geosuggest.

plraphael avatar plraphael commented on July 18, 2024

That is nice @ro-ka, thanks :)

from react-geosuggest.

ro-ka avatar ro-ka commented on July 18, 2024

Released in 1.4.0.

from react-geosuggest.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.