Skip to content

Instantly share code, notes, and snippets.

View vincevuong's full-sized avatar
🏠
Working from home

Vince Vuong vincevuong

🏠
Working from home
View GitHub Profile
@vincevuong
vincevuong / immutableUpdatePatterns.md
Created August 30, 2018 17:11
Immutable Update Patterns for Redux

Immutable Update Patterns

The articles listed in Prerequisite Concepts#Immutable Data Management give a number of good examples for how to perform basic update operations immutably, such as updating a field in an object or adding an item to the end of an array. However, reducers will often need to use those basic operations in combination to perform more complicated tasks. Here are some examples for some of the more common tasks you might have to implement.

Updating Nested Objects

The key to updating nested data is that every level of nesting must be copied and updated appropriately. This is often a difficult concept for those learning Redux, and there are some specific problems that frequently occur when trying to update nested objects. These lead to accidental direct mutation, and should be avoided.

Common Mistake #1: New variables that point to the same objects
@vincevuong
vincevuong / app.js
Created April 2, 2018 18:25 — forked from verticalgrain/app.js
React Router V4 Redirect after form submission
import React, { Component } from 'react'
import { Redirect } from 'react-router'
export default class ContactForm extends Component {
constructor () {
super();
this.state = {
fireRedirect: false
}
}
@vincevuong
vincevuong / readmeTemplate.md
Created October 10, 2017 02:51
README.md template

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@vincevuong
vincevuong / Markdown_Reference.md
Last active September 27, 2017 05:37
Guide to creating a README.md / Markdown page

Aligning images

left alignment

This is the code you need to align images to the left:

<img align="left" width="100" height="100" src="http://www.fillmurray.com/100/100">