<Router history={hashHistory}>
<Route path="/" component={UserHome}>
<Route path="NewPatient" component={NewPatient} />
</Route>
</Router>
return (
<div className="UserHome ">
{this.props.children && React.cloneElement(this.props.children, {
patientUr: this.state.patient_ur
})}
</div>
)
var myArray = JSON.parse( response );
console.log( myArray[ 0 ][ "patient_ur" ] );
button.onclick = function(){
delete button.onclick;
var xhr = new XMLHttpRequest();
....
xhr.onload = function(){
//Что-то делаем
button.onclick = function(){
//Выпадание меню
}
}
}
button.addEventListener("click", function one(){
button.removeEventListener("click", one);
var xhr = new XMLHttpRequest();
....
xhr.onload = function(){
//Что-то делаем
button.addEventListener("click", function(){
//Выпадание меню
});
}
});
$(button).one("click", function(){
$.ajax(...).done(function(){
//Что-то делаем
$(button).click(function(){
//Выпадание меню
});
});
});
<ul id="load_numAll-shet" style="display:none">
<li data-n="10" class="load_numAll-li">10</li>
<li data-n="50" class="load_numAll-li">50</li>
<li data-n="70" class="load_numAll-li">70</li>
<li data-n="80" class="load_numAll-li">80</li>
</ul>
<output id="load_numAll-show"></output>
var output = document.querySelector("#load_numAll-show"),
lies = document.querySelectorAll(".load_numAll-li");
output.value = Array.prototype.reduce.call(
lies, function(p, t){
return p + (+t.dataset.n);
}, 0
);
var i //Создать переменную i (undefined) в данной области видимости
= i; //Затем присвоить ей значение переменной переменной i (которую только что создали - undefined)
var dayOne = $('.day-one').val().split("."),
dayTwo = new Date("Fri Jan 09 2015 00:00:00 GMT+0300 (MSK)")
;
dayOne = new Date(dayOne[2], +dayOne[1] - 1, dayOne[0]);
alert(dayTwo > dayOne);
if ($(window).width() >= tablet)
{
size_media_container();
isotope_projects();
init_project_info_control();
}
test = true;
test && (alert(1), alert(2), alert(3));
test = false;
test && (alert(1), alert(2), alert(3));
import express from 'express';
import React from 'react';
import Router from 'react-router';
import Location from 'react-router/lib/Location';
import App from '/path/to/App';
import routes from '/path/to/routes';
const app = express();
app.use(express.static(path.join(__dirname, 'public')));
app.use('/', middleware);
function middleware(req, res, next) {
const location = new Location(req.path, req.query);
Router.run(routes, location, (error, initialState, transition) => {
const body = React.renderToString(<App {...initialState} />);
const layout = `${process.cwd()}/path/to/layout.jade`;
const html = Jade.compileFile(layout, { pretty: false })({ body });
res.send(html);
});
}
import express from 'express';
import React from 'react';
import Main from 'components/Main';
import About from 'components/About';
const app = express();
app.use(express.static(path.join(__dirname, 'public')));
app.get('/', (req, res) => middleware(req, res, Main));
app.get('/about', (req, res) => middleware(req, res, About));
function middleware(req, res, Component) {
const body = React.renderToString(<Component />);
const layout = `${process.cwd()}/path/to/layout.jade`;
const html = Jade.compileFile(layout, { pretty: false })({ body });
res.send(html);
}
/* Jade Layout */
doctype html
html
head
// head stuff...
body
#app!= body
script(src="/bundle.js")