My Simple React Tutorial.  #webdevelopment #react #reactjs #javascript #apps #reactjs
  • In this case, a state object might look like:state = {currentTime {hour: 0, minute: 0, second: 0}, alarms: [], timeZone: ‘PST’}Say again that you’re creating a component which represents a list of items stored in a table.
  • In this case you’re going to want to store the items in the list, maybe the size of the list, and also the label the list has all inside that components state.
  • Now some developers will say that i’m storing too much inside my state object, but personally I like to keep all of the relevant data to my component inside that components state.
  • Lets explore our example of the list of items component and see what it might look like:As you can see, the state is where all of our data is stored inside our component.
  • When addItem is called and it performs the setState function on the component, the components state will change, and thus trigger the component to re-render according to the new state object, thus including the new item in the list.

Read more


@ReactDOM: “My Simple React Tutorial. #webdevelopment #react #reactjs #javascript #apps #reactjs” open tweet »