Temporary states with modules

I have a parent module that has a child module nested within it. In the parent module I have a temp state, muniData. This temp state value is passed into the child module and is used to populate a form. When a certain action is performed in the child module I am trying to perform the .setIn function to update the muniData state in the parent module, but I keep getting an error saying that muniData.setIn is not a function.

Can a temp state in one module be updated from another module?


Hello, could you share more detail, screenshot or app json?

I have an application with a module inside of it (Module A). In Module A I run a query, of which the data result from that query gets set as a temporary state variable called ‘muniData'. The data within the muniData state then fills in a form (via module Input) that lives within another module (Module B). When changes are made in the form (that lives within Module B) these changes need to update the muniData state via the .setIn() function. Currently when I try to do this I receive an error saying muniData.setIn() is not a function...

This is kind of tricky currently :disappointed: I know our team is working on some module improvements over the next few months.

setIn can only work within the module where the variable was defined. It sounds like Module A has the variable, so you can call setIn only inside of Module A.

You can have another variable that gets updated on Submit of the form inside Module B. That variable can be an output of Module B.

Then, in Module A, you can use this approach to watch for changes to the output of Module B & then call setIn. Here's some screenshots of how setIn works.