Day 57

in #code7 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!