Skip to content

Instantly share code, notes, and snippets.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Application Design/Architecture

UI/UX/Design

@laneysmith
laneysmith / react-hooks-notes.md
Last active August 7, 2019 19:21
react-hooks-notes

useState

  • lets you add state to a functional component
  • state variables can hold objects and arrays; however, unlike this.setState in a class, updating a state variable always replaces it instead of merging it
import React, { useState } from 'react';

const Example = () => {
 // declare a new state variable & initialize it to 0

React & Redux in ES6

React

4 Main Ways to Create React Components

  • ES5 createClass
    • Auto-binds functions to components this context for you <div onClick={this.handleClick}></div>
     var HelloWorld = React.createClass({

render: function () {

ES:two::zero::one::five: cheatsheet :notebook:

DESTRUCTURING

Makes it easier to extract data from arrays or objects into distinct variables

Given the object foo:

var foo = {
	bar: 1,
	baz: 2
}
@laneysmith
laneysmith / auth-notes.md
Last active June 24, 2016 20:25
auth-notes
modules required
  • cookie-session: middleware that allows us to save cookies (which contain session ids) to browser
  • passport: middleware for Node
  • passport-local: strategy that allows us to save usernames & password to our own local databases
  • bcrypt: uses bcrypt encryption function
app.js
  • var session = require('cookie-session'); require this at the application level to make it accessible to all routes; below var bodyParser = ...
  • need to npm install cookie-session -S
  • var auth = require('./auth'); below var bodyParser = ...