This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Ramda | |
const R = require('ramda'); | |
const giveProp = (propName, prop, obj) => Object.assign({}, obj, {[propName]: prop}); | |
const givePropCurry = R.curry(giveProp); | |
const giveName = givePropCurry('name'); | |
const giveJob = givePropCurry('job'); | |
const giveHero = givePropCurry('hero'); | |
const giveJobSmuggler = giveJob('smuggler') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const R = require('ramda'); | |
const giveProp = (propName, prop, obj) => Object.assign({}, obj, {[propName]: prop}); | |
const givePropCurry = R.curry(giveProp); | |
const giveName = givePropCurry('name'); | |
const giveJob = givePropCurry('job'); | |
const giveHero = givePropCurry('hero'); | |
// Example 1: f(g(x)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Vanilla JS MVC</title> | |
</head> | |
<body> | |
<div class="counter"> | |
<button id="up">+</button> | |
<p id="count"></p> | |
<button id="down">-</button> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Backbone.js MVC</title> | |
</head> | |
<body> | |
<div id="app"></div> | |
<!-- App Dependencies --> | |
<script | |
src="https://code.jquery.com/jquery-3.1.1.slim.min.js"></script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Backbone.js MVC</title> | |
</head> | |
<body> | |
<div id="app"></div> | |
<!-- App Dependencies --> | |
<script | |
src="https://code.jquery.com/jquery-3.1.1.slim.min.js"></script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
import {createStore} from 'redux'; | |
import {connect, Provider} from 'react-redux'; | |
/********************************REDUX*****************************************/ | |
//default state | |
const INITIAL_STATE = { | |
value: 0 | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
import {createStore} from 'redux'; | |
import {connect, Provider} from 'react-redux'; | |
/********************************REDUX*****************************************/ | |
//default state | |
const INITIAL_STATE = { | |
value: 0 | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Vanilla JS</title> | |
</head> | |
<body> | |
<div class="counter"> | |
<button id="up">+</button> | |
<p id="count">0</p> | |
<button id="down">-</button> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Counter.jsx | |
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
// PRESENTATIONAL COMPONENT: a simple stateless React View | |
const Button = ({onClick, label}) => ( | |
<button onClick={onClick}>{label}</button> | |
); | |
// REACT COMPONENT: a stateful React View (stored in this.state) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Vanilla JS MVC</title> | |
</head> | |
<body> | |
<div class="counter"> | |
<button id="up">+</button> | |
<p id="count">0</p> | |
<button id="down">-</button> |