Skip to content

Instantly share code, notes, and snippets.

@carlymclift
Last active August 14, 2020 20:24
Show Gist options
  • Save carlymclift/99af9cc979d3a576bd4416c1e5f29761 to your computer and use it in GitHub Desktop.
Save carlymclift/99af9cc979d3a576bd4416c1e5f29761 to your computer and use it in GitHub Desktop.

Mod 3 Pre-work

Interview Questions

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

A data model is a diagram of data the application or system will use, and how it will flow. It includes a representation of the relationship between elements as well as include entity types, attributes, relationships, integrity rules, and the definitions of those objects.

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

A framework is going to typically have rules associated with it. A library will also have some rules but with more flexability. They are both going to contain pre-written functionality. When you call to a peice of code then it means you are calling to a library. When code calls to you (your code) then it is framework.

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

It's a good idea to use a framework so that keeping the UI up to date with the state is easier. With it the UIs are guaranteed to be in sync with the internal state of the application by watching for state changes and re-rendering the whole component. 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. It includes a combination of HTML, CSS, JS, and internal data that are all talking to eachother for a specific module. The data of the component will be either be contained in the component itself or the parent component. Each component has the ability to manage its own state and pass its state down to child components if needed. Create a component using React.Component Every component is required to have a render method because render discribes the UI of the component.

  • the render() function can only return a single node, so in case you want to return 2 siblings, just add a parent with any tag

What is JSX?

JSX (Stands for JavaScript XML) allows us to write HTML like syntax which gets transformed to lightweight JavaScript objects.

What are React "props?"

A prop is the data which is passed to the child component from the parent component.

What is React "state?"

A state in React is the internal data store (object) of a component.

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

Parent components pass action handlers into their children. The child component can invoke this handler in response to any event it chooses, so the child determines the action, but the parent determines how the action is handled.

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