It's really useful to be able to create temp state variables and edit them using the setIn() method. However, we're finding the documentation about how to use it being somewhat limited. On the docs page for temporary state, it says:
state.setIn(path, value: any)
Sets the value of state.value at a specified location. The path variable accepts an array of keys/indexes to select. I.E. state.setIn( [ 0, "trout" ], {length_inches: 16 } ). The value will be set without destroying and recreating the other values of the state.
This same exact example with the trout is repeated verbatim on the Scripting Retool page and the components page.
What's not clear to me is exactly what goes in that array, and how it should map to the data structure. What makes the trout example particularly difficult is that I can't find any example of what the overall data structure that we're updating looks like. Obviously I can get it to work with specific examples, but what exactly that path is, and how it's constructed, is not clear to me. I was wondering if this setIn() method is something that's just generally understood by JS developers, but I couldn't find documentation for it elsewhere online.
In the apps I've been working on, we have a lot of temp state variables with all kinds of nested objects, arrays, arrays of objects, etc. etc. It's be nice to be able to know exactly how setIn() can be used to go the most directly to the nested level / location of choice, to write the cleanest and most efficient code.
a.) Do folks have insights regarding generally what can go in this destination array?
b.) Do Retool folks think you might be able to flesh out the documentation a little more for other users?
Thanks!