Featuring
Reiter István - LogMeIn (Rescue)
"Nincs az az isten, hogy én ilyen webes vackokkal foglalkozzak!"
Reiter István (~2004)
Amiről szó lesz
Two-way binding && Unidirectional data-flow
import React from 'react';
import ReactDOM from 'react-dom';
class App extends React.Component{
render(){
<h1>Hello React!</h1>
}
}
ReactDOM.render(<App />, document.getElementById('app'));
JSX
State és props
class Hello extends React.Component{
constructor(props){
super(props);
}
render(){
return (
<div>
Hello {this.props.name}!
</div>
);
}
}
ReactDOM.render(
<Hello name="István" />,
document.getElementById('app'));
class Click extends React.Component{
constructor(props){
super(props);
this.state = {
value: 'alma'
};
this.sayNoToApple = this.sayNoToApple.bind(this);
}
sayNoToApple(){
this.setState({
value: 'béka'
});
}
render(){
return (
<div>
Hello {this.state.value}!
<button onClick={this.sayNoToApple} value='Click me!' />
</div>
);
}
}
Dumb Components - Smart Containers
ViewModel\Controller
ViewModel\Controller
ViewModel\Controller
ViewModel\Controller
View
View
View
View
Flux
Redux
Higher Order Function
function twice(f, v) {
return f(f(v));
}
function add3(v) {
return v + 3;
}
console.log(twice(add3, 7)); // 13
var peterParker = function PeterParker(superPower = []) { };
var mutantSpiderBite = function(human) {
return human(["eatFlies", "climbWalls", "shootWeb"]);
}
var spiderMan = mutantSpiderBite(peterParker);
"Advanced" témakörök
Pro\Kontra
Angular