eagle1000
11/19/2017 - 8:19 PM

React Definitions and Descriptions

This is my study sheet of different explanations to help me better understand React. It is a compilation of notes taken from Codecademy.

Props definition:
    *Information that gets passed from one component to another is known as "props."
    *Every component has something called props.
    *A component's props is an object. It holds information about that component.
    

Parent Component Class:
    *the component class that defines the event handler and passes it.

this.props.children:
    *Every component's props object has a property named children.
    *this.props.children will return everything in between a component's opening and closing JSX tags.
    
// Example 1
<BigButton>
  I am a child of BigButton.
</BigButton>


// Example 2
<BigButton>
  <LilButton />
</BigButton>

this.setState():
    * takes two arguments: an object that will update the component's state, and a callback. You basically never need the callback.
    *this.setState() takes an object, and merges that object with the component's current state. If there are properties in the current state that aren't part of that object, then those properties remain how they were.
    *Any time that you call this.setState(), this.setState() AUTOMATICALLY calls .render() as soon as the state has changed.