Skip to content

Instantly share code, notes, and snippets.

View btg5679's full-sized avatar
🎯
Focusing

bg btg5679

🎯
Focusing
View GitHub Profile
import React, { Component } from "react";
import { Image, Text, View, Button, Picker } from "react-native";
import { styles } from "../utils/styles";
import SomeCustomComponent from "./SomeCustomComponent";
// see https://github.com/necolas/react-native-web
class App extends Component {
_onButtonPress() {
//do some things
import { AppRegistry } from "react-native";
import App from "./components/App";
AppRegistry.registerComponent("App", () => App);
AppRegistry.runApplication("App", {
rootTag: document.getElementById("root")
});
//Explicit vs. Implicit Coercion in JS
let a = 100;
let b = a + ''; //IMPLICIT COERCION
console.log(b) //'100'
let c = String ( a ) //EXPLICIT COERCION
console.log(c) //'100'
function logger({ getState }) {
return (next) => (action) => {
console.log('will dispatch', action)
return returnValue
}
}
const initialState = {}
const enhancers = []
const middleware = [
function logger({ getState }) {
return (next) => (action) => {
console.log('will dispatch', action)
return returnValue
}
}
const initialState = {}
const enhancers = []
const middleware = [
...
const initialState = {}
const enhancers = []
const middleware = [
thunk,
routerMiddleware(history)
]
const composedEnhancers = compose(
var a = { name: 'Pilsner', abv: 5.4 };// Remains untouched
var b = Object.assign({}, a, {abv: 6.7})// b = { name: 'Pilsner', abv: 6.7 }}
var a = [0, 1, 2]// Remains untouched
var b = a.concat(3)// b = [0, 1, 2, 3]
var c = a.filter((val) => != 2)// c = [0, 1, 3]
var a = {name: 'Dave Matthews', songs: [0, 1, 2]}// Remains untouched
var b = Object.assign({}, a, {name: 'Jack Johnson'});// b = {name: 'Jack Johnson', songs: [0, 1, 2]}
b.songs = a.songs.concat(3);// b = {name: 'Jack Johnson', things: [0, 1, 2, 3]}
import { createStore } from 'redux';
// Store
const dataStore = createStore(r, {
beerlist: {
name: 'IPA',
abv: 7.4
},
beersOnTap: 1,
liveMusicHistory: {
import { createStore } from 'redux';
// Store
const dataStore = createStore(r, {
beerlist: {
name: 'IPA',
abv: 7.4
},
beersOnTap: 1,
liveMusicHistory: {
@btg5679
btg5679 / ReduxIntro2
Last active July 14, 2017 20:00
ReduxIntro2
import { createStore } from 'redux';
// Store
const dataStore = createStore(r, {
beerlist: {
name: 'IPA',
abv: 7.4
},
beersOnTap: 1,
liveMusicHistory: {