The basic question boils down to "Who should dictate if the alert is rendered?"
In this situation, what you return from your render method is always rendered to the screen. Let's start by making a hypothetical API
var onSubmit = function(title, description) { | |
// Do your ajax here | |
console.log(title, description); | |
}; | |
// Here we are opening up a lighbox to edit a title and description | |
// They will be the intial value of our component | |
flux.actions.widget.lightbox({ | |
view: ProfileContextEditCreate, | |
title: 'My awesome title', |
'use strict'; | |
var React = require('react'); | |
var _ = require('ramda'); | |
var moment = require('moment'); | |
var Day = require('components/day'); | |
var Calendar = require('components/calendar'); | |
class MultiCalendar extends React.Component { |
" ============================================================================== | |
" Install Bundles | |
" ============================================================================== | |
" Required for neocomplcache | |
set nocompatible | |
filetype off | |
set rtp+=~/.vim/bundle/vundle | |
call vundle#rc() | |
" Installed Bundles | |
Bundle 'editorconfig/editorconfig-vim' |
var http = require('http'); | |
http.createServer(function(req, res) { | |
res.setTimeout(0) | |
setTimeout(function() { | |
res.writeHead(200, {'Content-Type': 'text/html'}); | |
res.write('<p>Hello World</p>'); | |
res.end(); | |
}, 100) |
var IfElse = React.createClass({ | |
render: function() { | |
var contents = (something) ? <span>Hello</span> : <div>World!</div>; | |
return ( | |
<div> | |
{contents} | |
</div> | |
); | |
} |
browserify: { | |
options: { | |
debug: true, | |
transform: ['reactify'], | |
extensions: ['.jsx'] | |
}, | |
dist: { | |
files: { 'app/public/scripts/scripts.js': 'app/src/scripts/main.js'} | |
} | |
} |
// To play around with this code, copy and paste the contents of this gist | |
// into the javascript pane of http://jsbin.com/umoK/1/edit or go to | |
// http://jsbin.com/uZAfIqA/2/edit | |
// ============================================================================= | |
// Generic API | |
// ============================================================================= | |
//+ words :: string -> array | |
var words = split(' '); |
// Import settings | |
var settings = require('./settings'); | |
// Setup IRC | |
var irc = require('irc'); | |
var bot = new irc.Client(settings.server, settings.botName, settings); | |
console.log( | |
settings.botName + ' connecting to ' + settings.server + settings.channels | |
); |
function commentCommand(cmd) { | |
cmd = cmd || 'cmd'; | |
var result = require('execSync') | |
.exec('grep -nr "// '+cmd+':" ./') | |
.stdout | |
.split('\n')[0]; | |
if (result !== '') { | |
var reg = new RegExp('// '+cmd+':(.+)', 'i'); | |
result = result.match(reg)[1]; | |
} |