How to use the createClass function from react
Find comprehensive JavaScript react.createClass code examples handpicked from public code repositorys.
160 161 162 163 164 165 166 167 168 169
var React = require('react'); var model = new Backbone.Model({ helloWorld: 'Hello world!' }); var HelloWorld = React.createClass({ mixins: [backboneMixin], render: function () { return React.DOM.div({}, this.state.model.helloWorld); }
73
815
23
+ 7 other calls in file
80 81 82 83 84 85 86 87 88 89
var assetpath = function(filename) { return '../assets/' + filename; }; var Sprite = React.createFactory(ReactPIXI.Sprite); var DisplayObjectContainer = React.createFactory(ReactPIXI.DisplayObjectContainer); var CupcakeComponent = React.createClass({ displayName: 'CupcakeComponent', // maps from cupcake toppings to the appropriate sprite spritemapping : { 'vanilla' : assetpath('creamVanilla.png'),
73
741
27
+ 3 other calls in file
141 142 143 144 145 146 147 148 149 150
var React = require('react') var render = require('react-dom').render var hyperx = require('hyperx') var hx = hyperx(React.createElement) var App = React.createClass({ getInitialState: function () { return { n: 0 } }, render: function () { return hx`<div> <h1>clicked ${this.state.n} times</h1>
71
997
18
+ 3 other calls in file
28 29 30 31 32 33 34 35 36
} return children; }; var ParallaxScrollViewComposition = React.createClass({ propTypes: { scrollViewComponent: React.PropTypes.func, },
82
578
15
GitHub: kjda/ReactJs-Phonegap
0 1 2 3 4 5 6 7 8 9
/** @jsx React.DOM */ var React = require('react'); var _ = require('underscore'); var UI = require('react-topui'); module.exports = React.createClass({ propTypes: { links: React.PropTypes.array.isRequired },
42
260
20
+ 3 other calls in file
GitHub: amazeui/amazeui-react
2 3 4 5 6 7 8 9 10 11
var React = require('react'); var classNames = require('classnames'); var omit = require('object.omit'); var ClassNameMixin = require('./mixins/ClassNameMixin'); var Progress = React.createClass({ mixins: [ClassNameMixin], propTypes: { classPrefix: React.PropTypes.string,
235
0
92
GitHub: rccoder/amazeui-react
10 11 12 13 14 15 16 17 18 19
var Events = require('./utils/Events'); var isNodeInTree = require('./utils/isNodeInTree'); var createChainedFunction = require('./utils/createChainedFunction'); var canUseDOM = require('./utils/canUseDOM'); var Dropdown = React.createClass({ mixins: [ClassNameMixin], propTypes: { title: React.PropTypes.node.isRequired,
235
0
2
+ 3 other calls in file
GitHub: mjibson/moggio
10 11 12 13 14 15 16 17 18 19
var Column = FixedDataTable.Column; var Link = Router.Link; var Table = FixedDataTable.Table; var Tracks = (exports.Tracks = React.createClass({ mixins: [Reflux.listenTo(Stores.active, 'setActive')], getDefaultProps: function() { return { tracks: [],
26
365
19
+ 7 other calls in file
23 24 25 26 27 28 29 30 31 32
``` var React = require('react'); var ReactDOM = require('react-dom'); // 定义组件 var HelloMessage = React.createClass({ render: function() { return <div> React,我们来了... </div>; } });
59
153
12
GitHub: rvmey/TRIGGERcmd-Agent
372 373 374 375 376 377 378 379 380 381
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } var React = require('react'); // var AptList = React.createClass({ var AptList = /*#__PURE__*/function (_React$Component) { _inherits(AptList, _React$Component);
10
22
4
0 1 2 3 4 5 6 7 8 9
var _ = require('lodash') var React = require('react') var TriangleDown = require('./SVGCollection').TriangleDown var color = require('../../js/color') var GeneOpenMenu = React.createClass({ propTypes: { gene: React.PropTypes.object },
6
2
25
+ 4 other calls in file
1 2 3 4 5 6 7 8 9 10
var React = require('react') var GeneOpenMenu = require('../ReactComponents/GeneOpenMenu') var SVGCollection = require('../ReactComponents/SVGCollection') var color = require('../../js/color') var GenePanel = React.createClass({ propTypes: { gene: React.PropTypes.object.isRequired },
6
2
25
+ 3 other calls in file
58 59 60 61 62 63 64 65 66 67
结果发现大家真正需要的就是 DOM 节点本身,封装了半天完全是浪费感情。 于是在 v0.14 版中 refs 指向的就是 DOM 节点,同时也会保留 `.getDOMNode()` 方法(带 warning),最终在 v0.15 版中去除该方法。 ```javascript var Zoo = React.createClass({ render: function() { return <div>Giraffe name: <input ref="giraffe" /></div>; }, showName: function() {
2
23
13
+ 3 other calls in file
7 8 9 10 11 12 13 14 15 16 17 18 19
styler = require('react-styler'), Icon = require('./Icon'), Button = require('./Button'), Input = require('./Input'); var FileUploader = React.createClass({ displayName: 'FileUploader', propTypes: {
1
5
15
25 26 27 28 29 30 31 32 33 34 35 36 37
slider: require('react-color/lib/components/slider/Slider'), swatches: require('react-color/lib/components/swatches/Swatches') }; })(); var ColorPicker = React.createClass({ displayName: 'ColorPicker', propTypes: {
1
5
15
6 7 8 9 10 11 12 13 14 15 16 17 18
numeral = require('numeral'), DropDownContent = require('./DropDownContent'), ScrollableContent = require('./ScrollableContent'), styler = require('react-styler'); var ChartLegend = React.createClass({ displayName: 'ChartLegend', propTypes: {
1
5
15
9 10 11 12 13 14 15 16 17 18 19 20 21
_ = require('lodash'), styler = require('react-styler'), stringToBoolean = require('../helpers/stringToBoolean'), icons = require('../icons'); var CheckBox = React.createClass({ displayName: 'CheckBox', mixins: [styler.mixinFor('CheckBox')],
1
5
15
3 4 5 6 7 8 9 10 11 12 13 14 15
ReactDOM = require('react-dom'), _ = require('lodash'), Icon = require('./Icon'), styler = require('react-styler'); var Input = React.createClass({ displayName: 'Input', /**
1
5
15
144 145 146 147 148 149 150 151 152 153 154 155
clearTimeout(this.timeoutID); this.timeoutID = setTimeout.apply(null, arguments); } }; const ReactPlayground = React.createClass({ mixins: [selfCleaningTimeout], propTypes: { codeText: React.PropTypes.string.isRequired,
0
1
0
1 2 3 4 5 6 7 8 9 10 11
var WeatherForm = require('WeatherForm'); var WeatherMessage = require('WeatherMessage'); var ErrorModal = require('ErrorModal'); var openWeatherMap = require('openWeatherMap'); var Weather = React.createClass({ getInitialState: function () { return { isLoading: false }
0
0
1
react.default is the most popular function in react (505 examples)