I’m using this component for google autocomplete in a form. I’m running into a problem where I can’t seem to reset the component. (For my specific use case I need users to be able to fill out multiple forms one after the other if needed)
I’m testing with an array of these components and with a react hook updating to the index of the array of my choice
It looks something like this:
const [count, setCount] = useState(0) …. form_arr = [<LocationSelector count={count}></LocationSelector>, …] return( <div> {form_arr[count]} </div> )
I passed in the count into form_arr as a prop to check that it is actually indexing correctly and it is, however the component linked above does not change and retains the previous value somehow. Not sure why as it should be a different component instance right?
I hope this makes sense and am wondering if anyone knows how to fix this
submitted by /u/SpicyMintCake
[link] [comments]