Day 57

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

Coin Marketplace

STEEM 0.29
TRX 0.12
JST 0.033
BTC 69831.92
ETH 3744.43
USDT 1.00
SBD 3.77