function MONAD () {
return function unit(value) {
var monad = Object.create(null);
var Style = React.createClass({ | |
render: function() { | |
var style = assign({}, this.props); | |
delete style.children; | |
return React.createElement( | |
'div', | |
{style: style, children: this.props.children} | |
); | |
} |
var Immutable = require('immutable'); | |
var todos = OrderedMap(); | |
var TodoStore = createStore({ | |
getAll() { return todos; } | |
}); | |
Dispatcher.register(function(action) { | |
if (action.actionType === "create") { | |
var id = createGUID(); |
// converts commonJS requires to es6 imports | |
// var foo = require('foo'); | |
// -> | |
// import foo from 'foo'; | |
// | |
// jscodeshift -t requiresToImports.js src/**/*.js* | |
'use strict'; | |
module.exports = function(fileInfo, api) { | |
var j = api.jscodeshift; |
This is a response to Bill Fisher regarding experience with Flux:
@abdullin Also, can you clarify what you mean by "solution structure"? I am thinking about revising the examples soon.
Currently all flux samples (that I've seen) group files into folders based on technical similarity. For example, stores go with stores, action creators reside in the same folder shared with the other action creators.
This pattern works quite well for smaller projects. It feels especially good for the sample projects of various MVC frameworks, when you have just a bunch of controllers, models and views.
However, as we discovered on some production projects, such approach doesn't scale well. At some point you end up with dozens of technically similar files per folder and logically messy solution.
The article previously hosted here is now published on my website: My ErgoDox Keyboard.
You are probably here because you got the following error messages:
addComponentAsRefTo(...): Only a ReactOwner can have refs. You might be adding a ref to a component that was not created inside a component's
render
method, or you have multiple copies of React loaded.
This usually means one of two things:
- You are trying to add a
ref
to an element that is being created outside of a component's render() function. - You have multiple (conflicting) copies of React loaded (eg. due to a miss-configured NPM dependency)
Invalid Refs
.DS_Store | |
node_modules | |
.tmp | |
.sass-cache | |
builds/**/images/* |
(aka "errback" or "error first callback")
- Function that takes 2 arguments
- first argument is an error
- second argument is the result
- Never pass both
- error should be instanceof Error
- Must never excecute on the same tick of the event loop
- Must be passed as last argument to function