You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm saving location data in my API and I need to pre-populate the field with that data so it can be modified if needed. Is there a reliable way to do this? Preferably similar to a defaultValue prop or some controlled/uncontrolled state.
I'm looking at Google's documentation for the Autocomplete class and it looks like they don't have any first-class options/methods for this. I was just wondering if anyone in the community has found a sensible workaround.
We can try to manually propagate the value with a combination of manual assignment (...querySelector().value = location) and setTimeout, but this is highly unreliable and rather hacky.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm saving location data in my API and I need to pre-populate the field with that data so it can be modified if needed. Is there a reliable way to do this? Preferably similar to a
defaultValue
prop or some controlled/uncontrolled state.I'm looking at Google's documentation for the
Autocomplete
class and it looks like they don't have any first-class options/methods for this. I was just wondering if anyone in the community has found a sensible workaround.We can try to manually propagate the value with a combination of manual assignment (
...querySelector().value = location
) andsetTimeout
, but this is highly unreliable and rather hacky.Beta Was this translation helpful? Give feedback.
All reactions