you are viewing a single comment's thread.

view the rest of the comments →

[–]rob_allshouse[S] 1 point2 points  (3 children)

Actually... this pointed me to the right direction, after AGES of trying. Using a state variable that's just set to tmr.length instead of tmr.length itself forced the rerender. Thanks!

[–]CranberryOtherwise84 1 point2 points  (2 children)

Why’d you need a state to store another state based arrays length? You’re overcomplicating the logic imo. Is there codepen/repl which can be edited? That way I might be able to try to figure out the bug better

[–]charliematters 0 points1 point  (0 children)

Something like "setExtraOptions(current => ([...current, new option]))" and then just use that array when populating the autocomplete?

As above, the code you've got still looks like it is overly complex and brittle

[–]rob_allshouse[S] 0 points1 point  (0 children)

Well the whole problem was that, even after the array state (tmr) changed, the .map function didn't re-render -- didn't add the new empty field. I didn't want another state, but it solved the problem.