Skip to content

Instantly share code, notes, and snippets.

@kattak
Last active July 26, 2017 06:04
Show Gist options
  • Save kattak/5a88d425ea3f572e5abb712ef87a0d40 to your computer and use it in GitHub Desktop.
Save kattak/5a88d425ea3f572e5abb712ef87a0d40 to your computer and use it in GitHub Desktop.
Notes on enterprise React apps

Sift Science

1. Do more in componentDidUpdate

  • imperative vs. declarative
  • imperative: how you want to achieve
  • declarative: what you want to achieve
Declarative - often seen with:
  • i.e. promises

  • immutable objects

  • reduce state side-effects

  • more scalable

  • variables replaced with:

    • pipeline: set of data processing elems connected in a series with chained output > input
    • higher-order function: either/and takes function as an argument, returns a function as its result
    Example: component did update
    • Example: navigating to other contact, save current contact
    • In componentDidUpdate, check for unsaved changed, and save changes.
    More autonomous and reliable components
    • declaring actions to be invoked based on prop and state changes
    • technique esp useful for components that manage a lot of state

    2. Taking composition to the max

    • Library of components for controller compounds
    • SRP: single responsibility principle for deciding what gets to be its own component

    3. State Ownership

    ##### Stateless components & bubbling props 
    - Code smell: duplicating/synchornizing state between a parent and child component
    -> 
    

Links:

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