In an app, is it possible to remember (in app state) the device network ID of a device that the user selected in a device input , clear the input to re-purpose it, and then later retrieve and access that previously selected device for use in the app?
I am trying to create an interface that lets the user dynamically add any number of objects, with the various input fields being reused for adding each object. For example, I want to let the user add any number of "persons", and have for any new person a name input and a device input. When the user clicks the "submit" button, the app would pull the name in the name input and the device in the device input, and add the new person to the app's state. Then, if the user wants to add another person, the name input and the device input would be cleared, then would be filled in by the user for another person, and then when the user clicks the "submit" button this time, the app would pull the new name and the new device and store it in state again.
This works well for non-device inputs so far, but I don't know how to make it work well for device inputs. I can store the device input field in state, but I don't know if that does what I want it to or if it is just a snapshot of the device rather than a dynamic handle to the device. I need something like getDeviceByNetworkId(networkID). I don't suppose such a method exists or is there any workaround to make this work?