Skip to content

Instantly share code, notes, and snippets.

@simonhlee97
Last active September 16, 2017 20:35
Show Gist options
  • Save simonhlee97/d62af5a754944f5bcd647360983d27f1 to your computer and use it in GitHub Desktop.
Save simonhlee97/d62af5a754944f5bcd647360983d27f1 to your computer and use it in GitHub Desktop.
React: Getting Started (PluralSight)
  1. Your First Component
    Function Component vs Class Component

function: (presentational concept) simplest form. receives object of properties (props)

class: also has a function that has a private internal state. when state changes React will auto re-render that component.
Class components extend the React.Component class.

state vs. props:
state can be changed. props are fixed

  1. Reusable Components
    The STATE of a component can only be accessed by that component itself and no one else!
    Sibling elements must be wrapped in 1 element because React cant return multiple adjacent elements

** important React methods to remember **

  • setState

when planning/creating a React app:

  1. decide how many components to use, and what each comp should describe
  2. can plan Top-Down or down-up
  3. Function Comp have some advantages over Class Comp
  4. Only use Class Comp when you need to manage a state object
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment