Day 57

in code •  7 years ago 

March 11th, 2018

Hello! Today at the React for Beginners course by Wes Bos I learned about state, a very important but alas first a bit difficult bit.

What is state? It is basically just an object that lives inside of a component that stores all of the data that that component( as well as some children) needs.

     createFish = (event) => 
            const fish = {
            name:   this.nameRef.value.value,   // we reference the value in the object
          …
       }

      this.props.addFish(fish);   
              // refresh the form
             event.currentTarget.reset();

Updating just the data.
You can use data, and React will know where to update it. You need to set the initial empty state.
I definitely need to review this more.

Cheers!

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!