Advertisement
Guest User

Untitled

a guest
Jan 16th, 2016
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* @jsx React.DOM */
  2. window.Components = {};
  3.  
  4. window.Components.MyAwesomeWidget = React.createClass({
  5.     getInitialState: function() {
  6.         return {
  7.             color: '#000000'
  8.         };
  9.     },
  10.     render: function() {
  11.         console.log(this.props.caseSensitivePropertyName);
  12.  
  13.         var renderItem = function (item) {
  14.             return <li key={item.text}>{item.text}</li>;
  15.         };
  16.  
  17.         if (this.props.items === undefined) {
  18.             return <div></div>;
  19.         }
  20.  
  21.     return (React.DOM.div(null,
  22.         "<my-reactive-element>",
  23.             React.DOM.ul( {style: this.state}),
  24.                 this.props.items.map(renderItem)
  25.             ),
  26.         "</my-reactive-element>"
  27.     ));
  28.     },
  29.     changeColor: function(color) {
  30.         this.setState({
  31.             color: color
  32.         });
  33.     }
  34. });
  35.  
  36. document.registerReact('my-reactive-element', window.Components.MyAwesomeWidget);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement