1. 9
    Update React Application State from Form Input
    4m 7s

Update React Application State from Form Input

InstructorAndy Van Slaars

Share this video with your friends

Send Tweet

We’ll add a handler to the form so we can take new input and use it to update the application state. We’ll append new items to the list with the AddTodo function and replace the todos list in state. We’ll also clear out our form so it can accept new todos.

Reggie
~ 7 years ago

Anyone else not getting the id generated in the new todo?

Reggie
~ 7 years ago

nevermind, wasn't returning the newId in the generateID function

Dev
~ 7 years ago

Why generate a random ID number instead of incrementing a number? Chances of getting the same ID number based on that line of code shown in the video is quite small, but incrementing will ensure no duplicate ID number exists at all.

Grant
~ 6 years ago

Why generate a random ID number instead of incrementing a number? Chances of getting the same ID number based on that line of code shown in the video is quite small, but incrementing will ensure no duplicate ID number exists at all.

I noticed that too. There's alternatives for ensuring a unique ID that I would use instead: https://en.wikipedia.org/wiki/Universally_unique_identifier