Skip to content

Instantly share code, notes, and snippets.

@selfup
Forked from biglovisa/react-notes.md
Last active December 16, 2015 17:14
Show Gist options
  • Save selfup/8c21f0171b8f82a4a54c to your computer and use it in GitHub Desktop.
Save selfup/8c21f0171b8f82a4a54c to your computer and use it in GitHub Desktop.
React in theory

Use this gist to write down notes and questions as you read through the lesson plan. https://github.com/turingschool/lesson_plans/blob/master/ruby_04-apis_and_scalability/react_in_theory.markdown

What does React do?

It interacts with the DOM in a more elgant way than jQuery. No more DOM traversal. We can use specific locations and not have to change our CSS or HTML based on new inherant logic.

How does React interact with the DOM?

It uses the Virtual DOM to communicate with the actual DOM and figure out what needs to be updated. We can setState() and effectively tell React what to change in the event loop if a change has been requested.

JSX

JSX is like erb in that it is a sort of templating language that can pull real JS variables and display them to the screen.

Component hierarchy

Events Up and Data Down. We set Event listeners and they update their less intelligent children with the data. The children re-render and the parents are essentially helicopters.

State vs Props

State is mutable. Props are immutable. This provides a nice heiarchy of data structures for us to handle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment