// Grant Timmerman — @grant
The Frontend Framework
A library for building UI
of the Future
of TODAY
Please ask questions along the way!
Despite our long history, we still don't have a great way to build large frontend applications.
How should we structure our JavaScript applications?
two way databinding! WEAK
— Horse JS (@horse_js) April 8, 2015
props
: Immutable valuesstate
: Mutable valuesrender()
: Returns the component's htmlfunction setupHome () {
// Sets up map view
$('.back-page').click(function (e) {
if ($(e.target).hasClass('back-page')) {
$('.back-page').toggleClass('map-view');
}
});
var lastTime = $('.events.list').data('time');
function initialize() {
function updateCenter () {
$.get('/api/location', function (location) {
var panPoint = new google.maps.LatLng(location.lat, location.lng);
map.panTo(panPoint);
});
}
Global $
DOM selector/event binding madness
render: function() { ... }
should return JSX
var data = [
{ text: "message 1" },
{ text: "message 2" }
]
var myHTML =
{data[0].text}
{data[1].text}
produces
message 1
message 2
render: function() {
var otherValue = 'bar';
return (
Below is my custom button component.
<MyButton myProp='foo' myOtherProp={otherValue}/>
);
}
var HelloMessage = React.createClass({
render: function() {
return Hello {this.props.name};
}
});
React.render(<HelloMessage name="UW Hackers" />, mountNode);
If you're trying to achieve, there will be roadblocks. I've had them; everybody has had them. But obstacles don't have to stop you. If you run into a wall, don't turn around and give up. Figure out how to climb it, go through it, or work around it.~Michael Jordan