The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

298028 (3) [Avatar] Offline
#1
in the v8 pdf

p 72 - let todoIndex = 0
p 74 - const todoIndex = 0

1) Is there a reason this isn't part of the component state?

2) I'm surprised that marking todoIndex as 'const' you are able to update the number in submitTodo()
287516 (45) [Avatar] Offline
#2
Hello, and thanks for pointing this out!

`todoIndex` should indeed be let not const consistently, we will update this in the next release.

As far as todoIndex being stored in the state, it may make more sense to do so, but it is also worth noting this pattern as it is sometimes used in Redux which we will be covering at a later time, though I think in this case storing it in the state would be less confusing and I may refactor to do so in a future release.

Thanks for the feedback, much appreciated!