Skip to content

Instantly share code, notes, and snippets.

@ericberglund117
Created October 1, 2020 19:41
Show Gist options
  • Save ericberglund117/1d5abe2e646e4a61ce344ca150244341 to your computer and use it in GitHub Desktop.
Save ericberglund117/1d5abe2e646e4a61ce344ca150244341 to your computer and use it in GitHub Desktop.
MOD 3 Prework

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

  • a data model is a way to organize and manipulate the data used for a webpage and the DOM is the browser's internal programatic representation of the webpage. This means a developer can modify the webpage using the data model without touching the HTML.

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

  • A framework a pre-defined structure that determines how a developer designs an application. Libraries are collections of prewritten code snippets that can be used (and reused) to perform common JavaScript functions. JavaScript libraries are like pieces of furniture that add style and function to an already constructed house. Frameworks, on the other hand, are a template you use to build the house itself.

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

  • I think we would consider using a framework over vanilla JS because it provides us with more structure and preset rules we have to follow. It makes things easier for the developer in the long run and possibly prevents certain errors because of the organization and efficiency of the framework.

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

  • React components are independent and reusable bits of code. Essentially, they are functions. They work in isolation and return HTML via a render function. Components are useful because they work in isolation and a developer can use functions to render/modify HTML elements.

What is JSX?

  • JSX stands for JavaScript XML and it can allow the developer to write HTML in React. It is helpful as a visual aid when working with UI inside the JavaScript code. It also allows React to show more useful error and warning messages.

What are React "props?"

  • React props are like arguments of a function. They cannot be changed once set. For example: if you have a JSX function (). The props are the placed together in a single object and are passed to the Add component function as the first argument. Within that Add component function, the n1 and n2 are agruments being passed in.

What is React "state?"

  • React state is data that changes over time. It's intended to track data values over the lifetime of the component (so long as the component exists on the page).

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

  • "data down, actions up" refers to code that passes data down into their child components and how the action is then passed back up. A function can be passed down and the parent component needs to be notified of the change. This is how we send the action back up. The only way that we are able to send any changes or actions back up the component hierarchy is by following the data down, action up rule.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment