Help with Google Autocomplete Component and Refs

This page summarizes the projects mentioned and recommended in the original post on /r/reactjs

Our great sponsors
  • SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • react-google-autocomplete

    React components for google places API.

  • I am using the Google Autocomplete component and when onPlaceSelected I am saving the place into a state array (input) of the parent component. However, whenever a place is selected the previous value is set to an empty array and then adds the newly selected place, instead of adding it to the existing array. I am thinking it has something to do with refs (since I think the component uses these), but I'm not sure how to start fixing it, since I am not very experienced in using refs. Any help or advice would be appreciated.

  • SurveyJS

    Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.

    SurveyJS logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts