I am building a re-frame app with a list of text input fields. I would like the behavior to be that when the user presses RETURN, a new row is created and focus is placed on the new row. I have succeeded in creating the new row, however, when I attempt to change focus to that new row with this call within change-focus event-handler:
(.focus (.getElementById js/document focus-element))
I am getting an error: Cannot read property 'focus' of null.
I presume that is because the view has not yet rendered the newly created row. What is the best way to go about changing focus to a new element using re-frame?
Should I put the active-row in my state atom and render that in the view? Or possibly fire another event after the view has been rendered? I'd love some input.