Skip to content

Instantly share code, notes, and snippets.

@mbburch
Forked from biglovisa/react-notes.md
Last active December 16, 2015 18:50
Show Gist options
  • Save mbburch/f753a200e8bd2ab60ddd to your computer and use it in GitHub Desktop.
Save mbburch/f753a200e8bd2ab60ddd 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's used to create user interfaces. Small components that present data. Tells HTML what to render and how to respond to events. (?Well structured component tree?) Clarify how different from regular JS and JQuery? Unclear.

How does React interact with the DOM?

Each component has a render function. It executes the code and renders the JS and HTML in the return statement. ?Virtual DOM? React listens for state changes (data that can change) and re-renders it (in contrast to polling the data). When setState is called in a component, React knows to re-render it. (?Clarify mounted on the DOM?)

JSX

Javascript HTML. Similar to ERB.

Component hierarchy

Components have parent-child relationships. Component tree should have smart parents that render state, and dumb children that are passed data and just render. Centralize state and minimize redundancy. Events up, data down. At top of component tree, events receive data and update state. At bottom of component tree, components simply receive data, render HTML, and send up user feedback from events. (?Would like a visual model of this?)

State vs Props

Didn't really understand this explanation. State can change/ prop can't? State is contained in components, but try to keep components stateless?

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