Skip to content

Instantly share code, notes, and snippets.

var Component = React.createClass({
getDefaultProps: function() {
console.log('getDefaultProps');
return {
title: "Basic counter!!!",
step: 1
}
},
getInitialState: function() {
var Container = React.createClass({
getInitialState: function() {
return {
data: null,
fetching: false,
error: null
};
},
render: function() {
var TextComponent = React.createClass({
shouldComponentUpdate: function(nextProps, nextState) {
if (this.props.text === nextProps.text) return false;
return true;
},
render: function() {
return <textarea value={this.props.text} />;
}
});
var Select2 = React.createClass({
componentDidMount: function() {
$(this._ref).select2({data: this.props.items});
},
render: function() {
return (
<select
ref={
function(input) {
class Counter extends React.Component {
constructor(props) {
super(props);
this.state = {count: 0};
this.incrementCounter = this.updateCounter.bind(this, 1);
this.decrementCounter = this.updateCounter.bind(this, -1);
}
render() {
return (
function allUniqueChars(str) {
if(!str) return false;
let checker = 0;
let flagIndex;
const length = str.length;
for (let i = 0; i < length; i++) {
flagIndex = str[i].charCodeAt(0) - 'a'.charCodeAt(0);
if ((checker & (1 << flagIndex)) > 0) return false;
// Imagine what would it be if connect, withRouter, injectIntl were child as function
export default (
<Connect mapStateToProps={mapStateToProps} mapPropsToActions={actions}>
{
(props) => (
<WithRouter>
{
(router) => (
<InjectIntl>
{(intl => <SomeComonent intl={intl} router={router} {...props} />}