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
var FlickrImageTime = React.createClass({ | |
render: function() { | |
return ( | |
<h3>Last updated: {moment(this.props.lastUpdate * 1000).fromNow()}</h3> | |
) | |
} | |
}) | |
var FlickrImage = React.createClass({ | |
render: function() { |
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
// většina tříd má vnitřní stav | |
class Store { | |
constructor(someState) { | |
this._state = someState | |
} | |
setState(state) { | |
this._state = 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
var currentReducer = reducer | |
var currentState = preloadedState | |
var currentListeners = [] | |
var nextListeners = currentListeners | |
var isDispatching = false | |
function dispatch(action) { | |
if (!isPlainObject(action)) { | |
throw new Error( |
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 createDispatch = (state, doThingsWithUpdatedState) => { | |
return (executeChange) => { | |
const newState = executeChange(state) | |
return doThingsWithUpdatedState(newState, createDispatch(newState, doThingsWithUpdatedState)) | |
} | |
} | |
const initialState = { counter: 0 } | |
const dispatch = createDispatch(initialState, (newState, dispatch) => { |
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
// runtime, co se dá ukrýt | |
const composeAsync = (...fns) => { | |
const shiftedFns = fns.slice() | |
return (...args) => new Promise(resolve => resolve(...args)) | |
.then(compose.apply(this, shiftedFns.map(fn => promiseOrValue => { | |
if (promiseOrValue instanceof Promise) { | |
return promiseOrValue.then(fn) | |
} |
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
<PhotoPicker | |
pickPhoto: this.props.pickingProfilePhoto, | |
onPhotoPicked: this._handlePhotoShot, | |
onPhotoPickCanceld: this._handlephotoCancel, | |
/> |
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
class ClassLikeCurry { | |
constructor() { | |
this.state = {} | |
} | |
getState() { | |
return this.state | |
} | |
setState(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
require.ensure([], (require) => { | |
const page = React.createFactory(require('./druha-stranka')) | |
this.setState({ page, url }) | |
}) |
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
<body><div id="app"></div></body> |
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 lang="cs"> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="x-ua-compatible" content="ie=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> | |
<!--[if lt IE 10]> |