Skip to content

Instantly share code, notes, and snippets.

@NicoleLatifi
Last active August 14, 2020 03:06
Show Gist options
  • Save NicoleLatifi/a90087ce65f8bd3b807373ce18118805 to your computer and use it in GitHub Desktop.
Save NicoleLatifi/a90087ce65f8bd3b807373ce18118805 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?

The data model refers to the original data or information that an application is built upon and depends on. The data model is the single source of truth that should not be changed or manipulated. The DOM is the browser's display of the application. It is the interface between JavaScript and HTML. When changing what is displayed to a user, the DOM should be manipulated, not the data model. These two need to remain separate in order to protect the data model.

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

There are two main differences between frameworks and libraries that help me understand the distinction better. First, frameworks generally have more rules and strict formatting than libraries. Second, when working with a framework, it is the framework that makes calls to your code, whereas with a library, you have the power to call the code whenever you like. This means that when using a framework, the framework is in charge of the flow and when using a library, you are in control of the flow of the application.

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

The main benefit of using a framework is that it helps with keeping the UI in sync with the state. This means you do not need to update the UI on every state change. Without a framework, keeping the UI in sync with the state requires a significant amount of code which means more opportunities for errors. It is not possible to write complex, efficient and easy to maintain UIs with Vanilla JavaScript.

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

Components are the building blocks of React. A component is essentially a collection of HTML, CSS, JS, and some internal data specific to that component.

What is JSX?

JSX — Allows us to write HTML like syntax which gets transformed to lightweight JavaScript objects.

What are React "props?"

Props, are used to pass properties down from a parent component to its child component similar to how arguments are passed into a function's parameters.

What is React "state?"

State can sometimes get confused with props. State holds data that represents the current state of an application. This means that state is changed by user interactions but props should be kept unmutated.

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

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