Skip to content

Instantly share code, notes, and snippets.

@StevieAmb
Last active January 28, 2022 23:55
Show Gist options
  • Select an option

  • Save StevieAmb/d5201045260f2d52fec1346e05e84926 to your computer and use it in GitHub Desktop.

Select an option

Save StevieAmb/d5201045260f2d52fec1346e05e84926 to your computer and use it in GitHub Desktop.
  1. What is a "data model", and how does it relate to the DOM in a front-end application?
  • A data model is the source of truth for all of the information that you are going to upload to a page. This relates to the DOM in the sense that you are going to be pulling the information that you want to upload onto the DOM to make your HTML more interactive from the data model. So any information you want the user to be able to interact with or use in any way, you are going to have that information come from the data model.
  1. What is a "framework?" And how does it differ from a "library?"
  • A framework and a library can actually seem very similar, and those words are sometimes used interchangeably. They are both a collection of code that are packaged and re-used. However, the way that a framework differs from a library is that a framework generally has more rules that a library. In addition, a framework calls to your code, much like the scripts file has methods that call to your class file methods.
  1. Why should we consider using a framework over vanilla JS like you have been doing in mods 1 and 2?
  • We consider using a framework over vaniall JS because it's a lot more complicated to quickly change the state with vanilla JS, and you have to write a lot more intricate code to do many things that are simple and repetitive from the user's standpoint, so a framework is better for making UI stuff a lot more simpler to code.

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

  • A component is a reusable piece of code that user JSX to render information onto a screen through the DOM. It is useful to have components because it keeps the code more organized based on there the information is coming onto the screen.

What is JSX?

  • JSX are pieces of HTML that you can write in the middle of Javascript in React, or functions that you can call by inserting them in curly brackets. It is a mixture of both HTML and JS (and some in-line CSS, too, that you can also do).
  1. What are React "props?"
  • React props are the different attributes you can give your react components when you're invoking them that get passed through as the "props" argument when you initially write your independent component. So it stores methods or info you're going to later use when you render that specific component.

What is React "state?"

  • The react state is essentially the data model for react, so it stores the data you're going to use to update the app, and it gives you the information the user is going to interact with or want to change.

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

  • Data down, action up means that data from the parent component moves down to the child component. However, action up means that when an event occurs, and the user takes some sort of action, that new information has to go back up to the parent element from the child to update the state in the parent component.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment