Skip to content

Instantly share code, notes, and snippets.

@KCWill
Last active May 1, 2020 22:20
Show Gist options
  • Save KCWill/62b60243d3a5eca3a6ef43c57ff8a337 to your computer and use it in GitHub Desktop.
Save KCWill/62b60243d3a5eca3a6ef43c57ff8a337 to your computer and use it in GitHub Desktop.

Module 3 Intermission Work

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

    In programming, a framework is a collection of tools that allow developers to create software. Frameworks have stricter rules about how code is written and do not allow for modifications to the framework's code. Libraries are different in that they have fewer rules about how they are written and allow for modifications. Libraries in general have fewer rules about usability compared to frameworks.

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

    A framework provides us tools to make more complicated web applications that do not depend on reloading and reinitializing every element on the page each time something is changed. In vanilla JS, each time one modifies the data model, the entire DOM must be updated as well. React only manipulates the areas of the DOM that have changed in the data model, thus not making the entire application reload and initialize objects.

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

    A component in React is a class that contains information about a certain element in an application. Components have properties (props) associated with them that can be passed to other components. Components usually have a parent component that take in props from different parts of an application. Components return a React element that React can use to update changes to the DOM. Components are useful because they allow only certain sections of applications to be updated. React can recognize a change in the React elements returned from components and update only the changed parts of the DOM.

  • What are React "props?"

    "Props" are short for properties in React components. A prop is used to pass data from one component to another. Props are always passed from parent component to child component (never child to parent nor child to child). A child component should never alter the prop data from a parent component.

  • What is React "state?"

    Each component in React can have a state. This is a value that can change when different functions or methods are performed with the React component. The state of a component is held in the this.state line of React component (object). Each time a state is changed, the React component is rendered to display the changes.

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

    "Data down, actions up" is a description of how information is passed around in React. Props (as functions or data) are passed into child components (data down). Once the data is in the child component, a method can be run with the props that were passed down. Once the data that was passed down modifies the child component, the change (or action) can be passed back up to the parent component to update state.

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