Last active
November 24, 2021 16:26
-
-
Save ivonne-hernandez/58c261cbb499ad59df51e89d9ffac884 to your computer and use it in GitHub Desktop.
Mod 3 Intermission Assignment
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Create a GitHub gist to answer these questions in as much detail as possible. Imagine someone is asking these questions in an interview (these are popular interview questions). | |
1. What is a "data model", and how does it relate to the DOM in a front-end application? | |
A data model is what holds onto the state of our application. It is a single source of truth for what | |
should display on the page. An example of a data model could be an array of objects. | |
2. What is a "framework?" And how does it differ from a "library?" | |
A framework provides a standard way to build and deploy applications. It is a universal, reusable software | |
environment that provides particular functionality as part of a larger software platform to facilitate | |
development of software applications, products and solutions. | |
Libraries are usually a bit smaller than frameworks and generally serve the purpose of providing us | |
with abstractions over complex code that we could otherwise have to write ourselves. | |
3. Why should we consider using a framework over vanilla JS like you have been doing in mods 1 and 2? | |
Standard methods of DOM manipulation are tedious, slow and brittle. It requires us to manually target | |
elements, it takes a long time for the browser to process DOM manipulations, and the amount of code it | |
requires makes it really fragile. There are too many places where we could go wrong with a simple typo. | |
Using a framework like React solves all three of these problems by providing us with a Virtual DOM, which | |
helps us reduce the amount of code and time it takes to update our UI. | |
4. What is a "component" in React? Why is it useful to have components? | |
A component is a reusable module that renders a part of our app. | |
These parts can be big or small but they are usually clearly defined: they serve a single, obvious purpose. | |
Components let you split the UI into independent, reusable pieces, and think about each piece in isolation. | |
Conceptually, components are like JS functions--they accept arbitrary inputs (called props) and return React | |
elements describing what should appear on the screen. | |
5. What is JSX? | |
JSX is a syntax extension to JavaScript that usually describes what the UI should look like. | |
JSX produces React "elements." i.e. it allows us to write HTML like syntax which gets transformed | |
to lightweightJavaScript objects. | |
6. What are React "props?" | |
React props are arbitrary inputs that are properties/object arguments with data that are passed into a React | |
component so that it can return a React element. React props are comparable to HTML attributes. | |
In React, dataflow is unidirectional: props can only be passed from Parent components down to Child components | |
and props are read-only. | |
7. What is React "state?" | |
The internal data store (object) of a component; it is similar to props but it is private and fully controlled by | |
the component. State allows React components to change/update their output over time | |
in response to user actions, network responses, and anything else. It's not possible to update the props a component | |
receives, only to read them. | |
8. What does "data down, actions up" mean in React? | |
"Data down" refers to the passing of data and/or functions via props from parent to child components. | |
"Action up" refers to sending data back up to the parent from the child component with the help of some action or event. | |
Note: As you do your research, stay away from React articles that talk exclusively about "hooks". We will be learning hooks in Mod 3 but they are not a requirement for success in the module. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment