Skip to content

Instantly share code, notes, and snippets.

@lahmatiy
Created September 10, 2015 20:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lahmatiy/66e8c94f68438e59e308 to your computer and use it in GitHub Desktop.
Save lahmatiy/66e8c94f68438e59e308 to your computer and use it in GitHub Desktop.
Find the difference
// react 0.14-rc1
var Zoo = React.createClass({
render: function() {
return <div>Giraffe name: <input ref="giraffe" /></div>;
},
showName: function() {
// Previously: var input = this.refs.giraffe.getDOMNode();
var input = this.refs.giraffe;
alert(input.value);
}
});
// basis.js
var Zoo = basis.ui.Node.subclass({
template:
'<div>Giraffe name: <input b:ref="giraffe" /></div>',
// or
// '<div>Giraffe name: <input{giraffe} /></div>'
showName: function() {
var input = this.tmpl.giraffe;
alert(input.value);
}
});
@limarc
Copy link

limarc commented Mar 17, 2016

Чем проще, тем популярнее basis.ui.Node.subclass vs React.createClass )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment