I’ve been working on my Pomodoro Clock React back-end for a day or so now and I’m stuck on one small aspect of the challenge which is, how do I get my session textarea to update its value after the decrement button is clicked (that’s all the working code that I have at the moment).
I can get the ‘clock’ to display the decremented session length value as I click the minus button, but the related textarea remains static at the initial value of 25.
My component structure is something like this:
PomodoroComp | +------SessionComponent (contains the decrement button I'm listening to and the text area) +------BreakComponent +------MainComp | +-------TimerComponent +-------TimeLeftComp (this one reacts properly to the decremented state)
I’m passing a callback function ‘decSession’ from PomodoroComp down to SessionComponent
and it is definitely calling it back each time the decrement button is clicked but though the state is getting updated, it somehow doesn’t re-render SessionComponent’s textarea with the new value.
If anyone has any thoughts on what I could be doing wrong, I would be very grateful to learn.
Link to my codepen: