Skip to content

Instantly share code, notes, and snippets.

@nware1066
Created August 14, 2020 21:50
Show Gist options
  • Save nware1066/9bc0590101c0d57524070cc7e9913de1 to your computer and use it in GitHub Desktop.
Save nware1066/9bc0590101c0d57524070cc7e9913de1 to your computer and use it in GitHub Desktop.
Pre-work for Turing Mod 3

1a. The data model is a construct that defines the properties, behaviors and default values for objects within our code. 1b. This relates to the DOM by providing information that is displayed on the DOM and providing a 'source of truth' for the code. Users can interact with the data, modifying the values within one instance of the object, but they do not change the data model, so that multiple instances of the model can be used by several users without altering the purpose or usefulness of the code.

  1. Frameworks and Libraries both provide reusable, pre-written code. Libraries are less structured, and can be used when and where the coder chooses. Frameworks are more stuctured and strictly define how the code will be written.

  2. A major consideration in using a framework is the ease with which it updates the DOM. Since a framework (such as React) will monitor changes in the DOM and update only those parts of the DOM that have changed, it is economical in terms of time and energy, and also ensures that the user is seeing current information, which has an obvious positive impact on the user experience.

  3. A react component is a portion of the User Interface. By using components, it is possible to isolate portions of the UI, allowing for moduluar code that it easier to manage.

  4. JSX, or Javascript Syntax Extension is a syntax that allows html(ish) and javascript(ish) code to co-exist and function in the same file. Variables and functions can be interpolated into the html format, allowing cleaner, more readable code.

  5. The React 'prop' is equivilant to a property in vanilla javascript. React components have a 'prop' which, by default is an empty object, and can contain whatever values are passed into it. These values will be used by the component and passed on to any 'children' of that component. Props are immutable.

  6. State refers to a components current values or information, which can change (usually based on information passed by the user). State should always start with a default value, which can be mutated by the component which contains that state.

  7. As I understand it, 'data down, actions up' describes how information (or 'state') is communicated between parent and child components in React. Information can be passed from parent to child (down) as props, and information can be passed from child to parent (up) by passing values through functions (that were passed down as props) When the function is called, the parent can access the value that was passed through the function. This is a little confusing to me, to be honest.. I think it will become clear as I see it being used.

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