Skip to content

Instantly share code, notes, and snippets.

@leighlars
Last active August 7, 2020 19:28
Show Gist options
  • Save leighlars/6139a317b6fe702f7b30260fc1ca00db to your computer and use it in GitHub Desktop.
Save leighlars/6139a317b6fe702f7b30260fc1ca00db to your computer and use it in GitHub Desktop.
#### What is a "data model", and how does it relate to the DOM in a front-end application?
Data model is your source of truth, it contains all raw data and its respective format. The data can be added or deleted, but it's pretty much the same, neutral data throughout the project. The DOM is how the data can be manipulated, accessed, by the crafted style application. This can be changed depending on the dev's needs / desires.
#### What is a "framework?" And how does it differ from a "library?"
A library is much smaller, less rules than a framework. We make the call to the library, whereas the framework calls our code. A good example would be jQuery vs Django.
#### Why should we consider using a framework over vanilla JS like you have been doing in mods 1 and 2?
We need to maintain that the UI is in sync with the state. It's not possible to implement efficient and complex UI with vanilla JS.
#### What is a "component" in React? Why is it useful to have components?
They're essentially widgets or modules. It is a bundle of HTML, CSS, and JS. Components can be nested, and this parent/child hierarchy makes data management relatively simple because we know exactly the location of the data and we shouldn’t manipulate that data anywhere else.
#### What is JSX?
It is a library that serves to be a combination of JS and XML.
#### What are React "props?"
The data passed from parent component to child component.
propTypes - allows you to control the type of props passed from parent to child
defaultProps - allows you to set default props from parent to child
#### What is React "state?"
The internal data store (object) of a component. It can be initially set using the constructor (this.state), and updated using a helper method setState that rerenders the UI.
#### What does "data down, actions up" mean in React?
The action gets sent up to the parent class that determines how to handle the data below it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment