Skip to content

Instantly share code, notes, and snippets.

@EllieJellyBean
Last active May 7, 2021 19:31
Show Gist options
  • Select an option

  • Save EllieJellyBean/ea283422b8c42753bc10913af2c52e38 to your computer and use it in GitHub Desktop.

Select an option

Save EllieJellyBean/ea283422b8c42753bc10913af2c52e38 to your computer and use it in GitHub Desktop.
Mod 3 Pre-Work Questions

What is a "data model", and how does it relate to the DOM in a front-end application?

  • The "single source of truth". It holds all of the needed information that will be held and/or used in our application. The DOM is the actual visual display of our code and data model.

What is a "framework?" And how does it differ from a "library?"

  • Both a library and a framework is a collection of reusable code for others to reuse. With a library, you have a little more flexibility around when and where you can call the library. With a framework, there's less flexibility. The framework is in charge of the "flow" by providing places to "plug in" your code.

Why should we consider using a framework over vanilla JS like you have been doing in mods 1 and 2?

  • We use frameworks to "keep the UI in sync with the state". Frameworks can help by updating the DOM in a less expensive way. React creates a virtual DOM to check against instead of checking/updating the actual DOM, which is really expensive.

What is a "component" in React? Why is it useful to have components?

  • Components are the "building blocks of React". They are collections of code that represent aspects of the UI (like actual sections of the DOM). They can be nested within other components with parent/child relationships while holding the state of the data.

What is JSX?

  • JSX stands for "JavaScript XML" and allows us to write HTML elements in JavaScript and place them in the DOM without using any methods to do so.

What are React "props?"

  • The data that's passed from the parent to the child component, which seems similar to class inheritance with the use of "super" to pass down props from parent to child.

What is React "state?"

  • The internal data of a component. It's similar to props, but directly initialized and managed by the component.

What does "data down, actions up" mean in React?

  • Data is passed down from the parent component to the child component (data down). After it's passed down and a change is made, the parent needs to be notified so the action is sent "back up" to the parent component.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment