Skip to content

Instantly share code, notes, and snippets.

@nickhartdev
Last active August 14, 2020 19:10
Show Gist options
  • Save nickhartdev/ce02f46d33cb783c15cfe75cee8e1a94 to your computer and use it in GitHub Desktop.
Save nickhartdev/ce02f46d33cb783c15cfe75cee8e1a94 to your computer and use it in GitHub Desktop.

Mod 3 Prework - Nick Hart

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

The data model is term we use to refer to how and where our information is stored and manipulated. The DOM is just the bridge between the data model and how all of that data shows up on the page - by accessing and manipulating the DOM, a developer can tell it where and how to display relevant data.

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

From my understanding right now, I see a framework as a sort of "code foundation" that a developer uses to build their applications off of - it's a collection of libraries and specific sets of rules about how and when to use those libraries. Its difference from a library stands out in that libraries don't care how and when you use their code - within a framework though, you have a specific set of rules that you have to adhere to.

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

Tying the display logic and the data logic together in vanilla JS is hard. Now, with the introduction of modern frameworks like React or Angular, they do a lot of the heavy lifting for us. That's the main argument to be made for using a framework over vanilla JS.

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

A component is a piece of reusable code in React, usually a class or a function, that accepts inputs and then uses the info from those inputs to decide how a piece of information is displayed in a UI. Components keep your code modular, easy to test, and help with scalability of your application.

What is JSX?

JSX is a JavaScript syntax extension that allows you to write HTML-like code in your JavaScript to explicitly describe and produce React elements.

What are React "props"?

Props, short for properties, are pieces of information passed between React components (as objects) that affect how those components render.

What is React "state"?

State functions kind of similarly to props - they're pieces of information that influence how React components render. The key difference between state and props is that state is only manageable within its respective component. A component's state isn't passed in like a prop would be.

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

Basically, if you have multiple components that all need to render in response to a piece of data changing, you want the new information to start with the parent component and get passed down as a prop to its children components. Once the information has trickled all the way down to the final child component, the corresponding changes to a state start with that child component and ripple their way back up, all the way to the original parent.

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