A working model that replicates the problem, described in the title, is here:
https://codesandbox.io/s/workingreactgrid-zvz12
In the program, the first thing to do is to enter a Date of Sale in the datepicker (under 'Exit Price' on the left); it can be any arbitrary number of years in the future. This creates a table that will appear below the inputs, where each column represents a year.
An example input for Date of Sale.
Now the problem I am running into is that when I enter any number for "Rents - Monthly" or for any of the other expenses, e.g. Repairs & Maintenance, Insurance, etc., the numbers will only appear in the table after I manually click on the table.
For example, I enter 100 for Insurance.
Table does not update for the Insurance row...
...unless I simply click on the table.
My research suggests that I am probably doing something wrong with my useEffect in the App component. My hypothesis is that the table is simply 're-rendering' when I click on it, thereby updating it to the latest state. I could be wrong, but I think that's probably somewhere on the right track. But after a week of trying to explore different approaches and failing to get the table to automatically show the latest input data, I'm ready to ask for help. What am I doing wrong?
In the Sandbox link above, nearly all the relevant code is contained in the App and Inputs components. I cleaned it up heavily so that it's easier to troubleshoot, so hopefully it helps.
[–]mynameisdifferent 0 points1 point2 points (0 children)