├── .gitignore
├── README.md
├── build
├── 1.bundle.js
├── 1.bundle.js.map
├── 2.bundle.js
├── 2.bundle.js.map
├── 3.bundle.js
├── 3.bundle.js.map
├── 4.bundle.js
├── 4.bundle.js.map
├── 5.bundle.js
├── 5.bundle.js.map
├── 6.bundle.js
├── 6.bundle.js.map
├── 7.bundle.js
├── 7.bundle.js.map
├── bundle.js
├── bundle.js.map
├── index.html
├── prism.css
├── prism.min.js
├── vendor.bundle.js
└── vendor.bundle.js.map
├── demo1
└── demo1.jsx
├── demo2
└── demo2.jsx
├── demo3
└── demo3.jsx
├── demo4
└── demo4.jsx
├── demo5
└── demo5.jsx
├── demo6
├── demo6.jsx
├── demo6.less
├── item.jsx
└── store.jsx
├── demo7
└── demo7.jsx
├── index.jsx
├── package.json
└── webpack.config.js
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
2 | npm-debug.log
3 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | React Primer
2 | ============
3 |
4 | This little repo is designed to gently introduce developers into the wonderful world of React. Each demo's source is annotated with comments and can be read basically top-to-bottom.
5 |
6 | View the Demos
7 | --------------
8 |
9 | The demos are [available online](http://binarymuse.github.io/react-primer/build/).
10 |
11 | Running Locally
12 | ---------------
13 |
14 | Clone the repository and open `build/index.html` in your browser; the demos are pre-built and checked in to the repo.
15 |
16 | Building
17 | --------
18 |
19 | Requires Node.js.
20 |
21 | npm install && npm start
22 |
23 | Then open `build/index.html` in your browser. The Node process will automatically recompile the demos on any change; check your console output for syntax errors.
24 |
25 | Further Reading
26 | ---------------
27 |
28 | The [React site](http://facebook.github.io/react/) has a ton of info, and I recommend checking it out. It also contains more in-depth API documentation.
29 |
30 | The "Top-Down Data Flow & shouldComponentUpdate" demo introduces the idea of a top-level data store that causes an application-wide re-render whenever its data changes; this is a nice stepping stone to the [flux architecture](http://facebook.github.io/flux/docs/overview.html), including flux libraries like [Fluxxor](http://fluxxor.com/).
31 |
--------------------------------------------------------------------------------
/build/1.bundle.js:
--------------------------------------------------------------------------------
1 | webpackJsonp([1],{3:/*!*************************!*\
2 | !*** ./demo1/demo1.jsx ***!
3 | \*************************/
4 | function(e,t,n){var r=n(/*! react */1),a=r.createClass({displayName:"HelloComponent",render:function(){return r.DOM.div(null,"Hello ",this.props.name,r.DOM.strong(null,"!"))}}),o=r.createFactory(a);r.render(o({name:"Minerva"}),document.getElementById("container"))},10:/*!****************************************!*\
5 | !*** ./~/raw-loader!./demo1/demo1.jsx ***!
6 | \****************************************/
7 | function(e){e.exports='var React = require("react");\n\n// Create a ReactComponent class with `React.createClass`. Pass the\n// class to `React.createFactory` to create a function that, when\n// called, creates a `ReactElement` object with that type.\n// React uses ReactElements to create a virtual DOM that determines\n// how the real DOM should look and behave.\nvar HelloComponent = React.createClass({\n // Every component needs a `render` function that returns a\n // ReactNode. A ReactNode is either:\n //\n // * a ReactElement\n // * a string (aka ReactText)\n // * a number (aka ReactText)\n // * an array of ReactNodes (aka ReactFragment)\n //\n // ReactElement factories that produce ReactElements that represent\n // native HTML elements can be found on `React.DOM`.\n render: function() {\n // ReactElement factories take a hash of properties as their\n // first argument and their children as remaining arguments.\n // Here, we utilize `this.props`, which is an object\n // containing the properties passed to this component.\n //\n // Properties should be treated as immutable--you should\n // not try to change them from inside a component; they\n // belong to whoever passed them to you!\n return React.DOM.div(null, "Hello ", this.props.name,\n React.DOM.strong(null, "!")\n );\n }\n});\n\nvar HelloElementFactory = React.createFactory(HelloComponent);\n// ReactElement factories are just a convenience for creating new\n// ReactElements.\n//\n// var element = HelloElementFactory(properties, children...)\n//\n// is the same as\n//\n// var element = React.createElement(HelloComponent, properties, children...)\n\n// We can render a component into a DOM node with `React.render`,\n// which takes a ReactElement and a DOM node to render into.\nReact.render(\n // We pass `"Minerva"` as the `name` property, which is\n // used in `HelloComponent`\'s `render` function.\n HelloElementFactory({name: "Minerva"}),\n document.getElementById("container")\n);\n'}});
8 | //# sourceMappingURL=1.bundle.js.map
--------------------------------------------------------------------------------
/build/1.bundle.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"sources":["webpack:///1.bundle.js","webpack:///./demo1/demo1.jsx","webpack:///./demo1/demo1.jsx?9f79"],"names":["webpackJsonp",3,"module","exports","__webpack_require__","React","HelloComponent","createClass","displayName","render","DOM","div","this","props","name","strong","HelloElementFactory","createFactory","document","getElementById",10],"mappings":"AAAAA,cAAc,IAERC;;;AAIA,SAASC,EAAQC,EAASC,GCNhC,GAAIC,GAAQD,cAAQ,GAOhBE,EAAAD,EAAAE,aAAoCC,YAAA,iBAWtCC,OAAQ,WASN,MAAOJ,GAAMK,IAAIC,IAAI,KAAM,SAAUC,KAAKC,MAAMC,KAC9CT,EAAMK,IAAIK,OAAO,KAAM,SAKzBC,EAAsBX,EAAMY,cAAcX,EAY9CD,GAAMI,OAGJO,GAAqBF,KAAM,YAC3BI,SAASC,eAAe,eDcpBC;;;AAIA,SAASlB,GEnEfA,EAAAC,QAAA","file":"1.bundle.js","sourcesContent":["webpackJsonp([1],{\n\n/***/ 3:\n/*!*************************!*\\\n !*** ./demo1/demo1.jsx ***!\n \\*************************/\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar React = __webpack_require__(/*! react */ 1);\n\t\n\t// Create a ReactComponent class with `React.createClass`. Pass the\n\t// class to `React.createFactory` to create a function that, when\n\t// called, creates a `ReactElement` object with that type.\n\t// React uses ReactElements to create a virtual DOM that determines\n\t// how the real DOM should look and behave.\n\tvar HelloComponent = React.createClass({displayName: 'HelloComponent',\n\t // Every component needs a `render` function that returns a\n\t // ReactNode. A ReactNode is either:\n\t //\n\t // * a ReactElement\n\t // * a string (aka ReactText)\n\t // * a number (aka ReactText)\n\t // * an array of ReactNodes (aka ReactFragment)\n\t //\n\t // ReactElement factories that produce ReactElements that represent\n\t // native HTML elements can be found on `React.DOM`.\n\t render: function() {\n\t // ReactElement factories take a hash of properties as their\n\t // first argument and their children as remaining arguments.\n\t // Here, we utilize `this.props`, which is an object\n\t // containing the properties passed to this component.\n\t //\n\t // Properties should be treated as immutable--you should\n\t // not try to change them from inside a component; they\n\t // belong to whoever passed them to you!\n\t return React.DOM.div(null, \"Hello \", this.props.name,\n\t React.DOM.strong(null, \"!\")\n\t );\n\t }\n\t});\n\t\n\tvar HelloElementFactory = React.createFactory(HelloComponent);\n\t// ReactElement factories are just a convenience for creating new\n\t// ReactElements.\n\t//\n\t// var element = HelloElementFactory(properties, children...)\n\t//\n\t// is the same as\n\t//\n\t// var element = React.createElement(HelloComponent, properties, children...)\n\t\n\t// We can render a component into a DOM node with `React.render`,\n\t// which takes a ReactElement and a DOM node to render into.\n\tReact.render(\n\t // We pass `\"Minerva\"` as the `name` property, which is\n\t // used in `HelloComponent`'s `render` function.\n\t HelloElementFactory({name: \"Minerva\"}),\n\t document.getElementById(\"container\")\n\t);\n\n\n/***/ },\n\n/***/ 10:\n/*!****************************************!*\\\n !*** ./~/raw-loader!./demo1/demo1.jsx ***!\n \\****************************************/\n/***/ function(module, exports, __webpack_require__) {\n\n\tmodule.exports = \"var React = require(\\\"react\\\");\\n\\n// Create a ReactComponent class with `React.createClass`. Pass the\\n// class to `React.createFactory` to create a function that, when\\n// called, creates a `ReactElement` object with that type.\\n// React uses ReactElements to create a virtual DOM that determines\\n// how the real DOM should look and behave.\\nvar HelloComponent = React.createClass({\\n // Every component needs a `render` function that returns a\\n // ReactNode. A ReactNode is either:\\n //\\n // * a ReactElement\\n // * a string (aka ReactText)\\n // * a number (aka ReactText)\\n // * an array of ReactNodes (aka ReactFragment)\\n //\\n // ReactElement factories that produce ReactElements that represent\\n // native HTML elements can be found on `React.DOM`.\\n render: function() {\\n // ReactElement factories take a hash of properties as their\\n // first argument and their children as remaining arguments.\\n // Here, we utilize `this.props`, which is an object\\n // containing the properties passed to this component.\\n //\\n // Properties should be treated as immutable--you should\\n // not try to change them from inside a component; they\\n // belong to whoever passed them to you!\\n return React.DOM.div(null, \\\"Hello \\\", this.props.name,\\n React.DOM.strong(null, \\\"!\\\")\\n );\\n }\\n});\\n\\nvar HelloElementFactory = React.createFactory(HelloComponent);\\n// ReactElement factories are just a convenience for creating new\\n// ReactElements.\\n//\\n// var element = HelloElementFactory(properties, children...)\\n//\\n// is the same as\\n//\\n// var element = React.createElement(HelloComponent, properties, children...)\\n\\n// We can render a component into a DOM node with `React.render`,\\n// which takes a ReactElement and a DOM node to render into.\\nReact.render(\\n // We pass `\\\"Minerva\\\"` as the `name` property, which is\\n // used in `HelloComponent`'s `render` function.\\n HelloElementFactory({name: \\\"Minerva\\\"}),\\n document.getElementById(\\\"container\\\")\\n);\\n\"\n\n/***/ }\n\n});\n\n\n/** WEBPACK FOOTER **\n ** 1.bundle.js\n **/","var React = require(\"react\");\n\n// Create a ReactComponent class with `React.createClass`. Pass the\n// class to `React.createFactory` to create a function that, when\n// called, creates a `ReactElement` object with that type.\n// React uses ReactElements to create a virtual DOM that determines\n// how the real DOM should look and behave.\nvar HelloComponent = React.createClass({\n // Every component needs a `render` function that returns a\n // ReactNode. A ReactNode is either:\n //\n // * a ReactElement\n // * a string (aka ReactText)\n // * a number (aka ReactText)\n // * an array of ReactNodes (aka ReactFragment)\n //\n // ReactElement factories that produce ReactElements that represent\n // native HTML elements can be found on `React.DOM`.\n render: function() {\n // ReactElement factories take a hash of properties as their\n // first argument and their children as remaining arguments.\n // Here, we utilize `this.props`, which is an object\n // containing the properties passed to this component.\n //\n // Properties should be treated as immutable--you should\n // not try to change them from inside a component; they\n // belong to whoever passed them to you!\n return React.DOM.div(null, \"Hello \", this.props.name,\n React.DOM.strong(null, \"!\")\n );\n }\n});\n\nvar HelloElementFactory = React.createFactory(HelloComponent);\n// ReactElement factories are just a convenience for creating new\n// ReactElements.\n//\n// var element = HelloElementFactory(properties, children...)\n//\n// is the same as\n//\n// var element = React.createElement(HelloComponent, properties, children...)\n\n// We can render a component into a DOM node with `React.render`,\n// which takes a ReactElement and a DOM node to render into.\nReact.render(\n // We pass `\"Minerva\"` as the `name` property, which is\n // used in `HelloComponent`'s `render` function.\n HelloElementFactory({name: \"Minerva\"}),\n document.getElementById(\"container\")\n);\n\n\n\n/** WEBPACK FOOTER **\n ** ./demo1/demo1.jsx\n **/","module.exports = \"var React = require(\\\"react\\\");\\n\\n// Create a ReactComponent class with `React.createClass`. Pass the\\n// class to `React.createFactory` to create a function that, when\\n// called, creates a `ReactElement` object with that type.\\n// React uses ReactElements to create a virtual DOM that determines\\n// how the real DOM should look and behave.\\nvar HelloComponent = React.createClass({\\n // Every component needs a `render` function that returns a\\n // ReactNode. A ReactNode is either:\\n //\\n // * a ReactElement\\n // * a string (aka ReactText)\\n // * a number (aka ReactText)\\n // * an array of ReactNodes (aka ReactFragment)\\n //\\n // ReactElement factories that produce ReactElements that represent\\n // native HTML elements can be found on `React.DOM`.\\n render: function() {\\n // ReactElement factories take a hash of properties as their\\n // first argument and their children as remaining arguments.\\n // Here, we utilize `this.props`, which is an object\\n // containing the properties passed to this component.\\n //\\n // Properties should be treated as immutable--you should\\n // not try to change them from inside a component; they\\n // belong to whoever passed them to you!\\n return React.DOM.div(null, \\\"Hello \\\", this.props.name,\\n React.DOM.strong(null, \\\"!\\\")\\n );\\n }\\n});\\n\\nvar HelloElementFactory = React.createFactory(HelloComponent);\\n// ReactElement factories are just a convenience for creating new\\n// ReactElements.\\n//\\n// var element = HelloElementFactory(properties, children...)\\n//\\n// is the same as\\n//\\n// var element = React.createElement(HelloComponent, properties, children...)\\n\\n// We can render a component into a DOM node with `React.render`,\\n// which takes a ReactElement and a DOM node to render into.\\nReact.render(\\n // We pass `\\\"Minerva\\\"` as the `name` property, which is\\n // used in `HelloComponent`'s `render` function.\\n HelloElementFactory({name: \\\"Minerva\\\"}),\\n document.getElementById(\\\"container\\\")\\n);\\n\"\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/raw-loader!./demo1/demo1.jsx\n ** module id = 10\n ** module chunks = 1\n **/"],"sourceRoot":""}
--------------------------------------------------------------------------------
/build/2.bundle.js:
--------------------------------------------------------------------------------
1 | webpackJsonp([2],{4:/*!*************************!*\
2 | !*** ./demo2/demo2.jsx ***!
3 | \*************************/
4 | function(e,n,t){var r=t(/*! react */1),a=r.createClass({displayName:"HelloComponent",render:function(){return r.createElement("div",null,"Hello ",this.props.name,r.createElement("strong",null,"!"))}});r.render(r.createElement(a,{name:"Minerva"}),document.getElementById("container"))},11:/*!****************************************!*\
5 | !*** ./~/raw-loader!./demo2/demo2.jsx ***!
6 | \****************************************/
7 | function(e){e.exports='// JSX is an XML-like syntax that simplifies composing React components.\n\nvar React = require("react");\n\n// When using JSX, you don\'t have to worry about creating\n// ReactElements or factories to generate them. JSX handles\n// all these details for you. This demo is functionally\n// identical to Demo 1.\nvar HelloComponent = React.createClass({\n // The JSX transpiler also supports (optional) ES6 features,\n // such as concise method syntax, which we\'re using here.\n render() {\n // Children are composed just like child XML/HTML nodes.\n // `{...}` can be used to interpolate raw JavaScript.\n return
Hello {this.props.name}!
;\n }\n});\n\nReact.render(\n // Properties look like HTML attributes.\n ,\n document.getElementById("container")\n);\n\n// It\'s worth noting that JSX assumes all calls with a\n// refers to an actual HTML element,\n// and all custom components must have an .\n'}});
8 | //# sourceMappingURL=2.bundle.js.map
--------------------------------------------------------------------------------
/build/2.bundle.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"sources":["webpack:///2.bundle.js","webpack:///./demo2/demo2.jsx","webpack:///./demo2/demo2.jsx?e438"],"names":["webpackJsonp",4,"module","exports","__webpack_require__","React","HelloComponent","createClass","displayName","render","createElement","this","props","name","document","getElementById",11],"mappings":"AAAAA,cAAc,IAERC;;;AAIA,SAASC,EAAQC,EAASC,GCJhC,GAAIC,GAAQD,cAAQ,GAMhBE,EAAAD,EAAAE,aAAoCC,YAAA,iBAGtCC,OAAM,WAGJ,MAAOJ,GAAAK,cAAA,MAAI,KAAC,SAAOC,KAAKC,MAAMC,KAAKR,EAAAK,cAAA,SAAO,KAAC,QAI/CL,GAAMI,OAEJJ,EAAAK,cAACJ,GAAcO,KAAC,YAChBC,SAASC,eAAe,eDkBpBC;;;AAIA,SAASd,GE3CfA,EAAAC,QAAA","file":"2.bundle.js","sourcesContent":["webpackJsonp([2],{\n\n/***/ 4:\n/*!*************************!*\\\n !*** ./demo2/demo2.jsx ***!\n \\*************************/\n/***/ function(module, exports, __webpack_require__) {\n\n\t// JSX is an XML-like syntax that simplifies composing React components.\n\t\n\tvar React = __webpack_require__(/*! react */ 1);\n\t\n\t// When using JSX, you don't have to worry about creating\n\t// ReactElements or factories to generate them. JSX handles\n\t// all these details for you. This demo is functionally\n\t// identical to Demo 1.\n\tvar HelloComponent = React.createClass({displayName: 'HelloComponent',\n\t // The JSX transpiler also supports (optional) ES6 features,\n\t // such as concise method syntax, which we're using here.\n\t render:function() {\n\t // Children are composed just like child XML/HTML nodes.\n\t // `{...}` can be used to interpolate raw JavaScript.\n\t return React.createElement(\"div\", null, \"Hello \", this.props.name, React.createElement(\"strong\", null, \"!\"));\n\t }\n\t});\n\t\n\tReact.render(\n\t // Properties look like HTML attributes.\n\t React.createElement(HelloComponent, {name: \"Minerva\"}),\n\t document.getElementById(\"container\")\n\t);\n\t\n\t// It's worth noting that JSX assumes all calls with a\n\t// refers to an actual HTML element,\n\t// and all custom components must have an .\n\n\n/***/ },\n\n/***/ 11:\n/*!****************************************!*\\\n !*** ./~/raw-loader!./demo2/demo2.jsx ***!\n \\****************************************/\n/***/ function(module, exports, __webpack_require__) {\n\n\tmodule.exports = \"// JSX is an XML-like syntax that simplifies composing React components.\\n\\nvar React = require(\\\"react\\\");\\n\\n// When using JSX, you don't have to worry about creating\\n// ReactElements or factories to generate them. JSX handles\\n// all these details for you. This demo is functionally\\n// identical to Demo 1.\\nvar HelloComponent = React.createClass({\\n // The JSX transpiler also supports (optional) ES6 features,\\n // such as concise method syntax, which we're using here.\\n render() {\\n // Children are composed just like child XML/HTML nodes.\\n // `{...}` can be used to interpolate raw JavaScript.\\n return
Hello {this.props.name}!
;\\n }\\n});\\n\\nReact.render(\\n // Properties look like HTML attributes.\\n ,\\n document.getElementById(\\\"container\\\")\\n);\\n\\n// It's worth noting that JSX assumes all calls with a\\n// refers to an actual HTML element,\\n// and all custom components must have an .\\n\"\n\n/***/ }\n\n});\n\n\n/** WEBPACK FOOTER **\n ** 2.bundle.js\n **/","// JSX is an XML-like syntax that simplifies composing React components.\n\nvar React = require(\"react\");\n\n// When using JSX, you don't have to worry about creating\n// ReactElements or factories to generate them. JSX handles\n// all these details for you. This demo is functionally\n// identical to Demo 1.\nvar HelloComponent = React.createClass({\n // The JSX transpiler also supports (optional) ES6 features,\n // such as concise method syntax, which we're using here.\n render() {\n // Children are composed just like child XML/HTML nodes.\n // `{...}` can be used to interpolate raw JavaScript.\n return
Hello {this.props.name}!
;\n }\n});\n\nReact.render(\n // Properties look like HTML attributes.\n ,\n document.getElementById(\"container\")\n);\n\n// It's worth noting that JSX assumes all calls with a\n// refers to an actual HTML element,\n// and all custom components must have an .\n\n\n\n/** WEBPACK FOOTER **\n ** ./demo2/demo2.jsx\n **/","module.exports = \"// JSX is an XML-like syntax that simplifies composing React components.\\n\\nvar React = require(\\\"react\\\");\\n\\n// When using JSX, you don't have to worry about creating\\n// ReactElements or factories to generate them. JSX handles\\n// all these details for you. This demo is functionally\\n// identical to Demo 1.\\nvar HelloComponent = React.createClass({\\n // The JSX transpiler also supports (optional) ES6 features,\\n // such as concise method syntax, which we're using here.\\n render() {\\n // Children are composed just like child XML/HTML nodes.\\n // `{...}` can be used to interpolate raw JavaScript.\\n return
Hello {this.props.name}!
;\\n }\\n});\\n\\nReact.render(\\n // Properties look like HTML attributes.\\n ,\\n document.getElementById(\\\"container\\\")\\n);\\n\\n// It's worth noting that JSX assumes all calls with a\\n// refers to an actual HTML element,\\n// and all custom components must have an .\\n\"\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/raw-loader!./demo2/demo2.jsx\n ** module id = 11\n ** module chunks = 2\n **/"],"sourceRoot":""}
--------------------------------------------------------------------------------
/build/3.bundle.js:
--------------------------------------------------------------------------------
1 | webpackJsonp([3],{5:/*!*************************!*\
2 | !*** ./demo3/demo3.jsx ***!
3 | \*************************/
4 | function(e,t,n){var a=n(/*! react */1),r=a.createClass({displayName:"Timer",getInitialState:function(){return{time:0}},componentDidMount:function(){this.timer=setInterval(this.tick,1e3)},componentWillUnmount:function(){this.timer&&clearInterval(this.timer)},tick:function(){this.setState({time:this.state.time+1})},render:function(){return a.createElement("div",null,"Time: ",this.state.time)}});a.render(a.createElement(r,null),document.getElementById("container"))},12:/*!****************************************!*\
5 | !*** ./~/raw-loader!./demo3/demo3.jsx ***!
6 | \****************************************/
7 | function(e){e.exports="var React = require(\"react\");\n\nvar Timer = React.createClass({\n // In addition to properties passed from parents, React\n // components can also contain an internal state, referenced\n // by `this.state`. `getInitialState` defines the value of\n // `this.state` when the component is first mounted.\n getInitialState() {\n return {\n time: 0\n };\n },\n\n // React provides lifecycle hooks to set up and tear\n // down components and third-party APIs if necessary.\n // Here, we start a timer when the component mounts...\n componentDidMount() {\n this.timer = setInterval(this.tick, 1000);\n },\n\n // ... and remove the timer when the component unmounts.\n // If we don't do this, we'll leak memory (and the timer\n // will continue to fire).\n componentWillUnmount() {\n this.timer && clearInterval(this.timer);\n },\n\n // Unlike properties, state is owned by the component, and\n // can be changed using a few methods. Note that you should\n // *never* modify `this.state` directly--always use an API\n // method to mutate the state.\n //\n // Our timer calls `setState`, which allows us to update one or\n // more keys in our state. The object passed to `setState` is\n // merged with the current state; we can use `replaceState` instead\n // if we don't want to merge.\n tick() {\n // Note that React auto-binds all top-level methods in the\n // object passed to `createClass` to the component instance.\n // Because of this, `this` inside the `tick` method is\n // automatically the component instance, and we didn't have\n // to use `this.tick.bind(this)` inside the `setInterval` call.\n this.setState({time: this.state.time + 1});\n },\n\n // Render is called automatically when a component's state is\n // updated with `setState`, `replaceState`, or when `forceUpdate`\n // is called. Composed components are automatically re-rendered.\n render() {\n return
Time: {this.state.time}
;\n }\n});\n\nReact.render(\n ,\n document.getElementById(\"container\")\n);\n"}});
8 | //# sourceMappingURL=3.bundle.js.map
--------------------------------------------------------------------------------
/build/3.bundle.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"sources":["webpack:///3.bundle.js","webpack:///./demo3/demo3.jsx","webpack:///./demo3/demo3.jsx?1559"],"names":["webpackJsonp",5,"module","exports","__webpack_require__","React","Timer","createClass","displayName","getInitialState","time","componentDidMount","this","timer","setInterval","tick","componentWillUnmount","clearInterval","setState","state","render","createElement","document","getElementById",12],"mappings":"AAAAA,cAAc,IAERC;;;AAIA,SAASC,EAAQC,EAASC,GCNhC,GAAIC,GAAQD,cAAQ,GAEhBE,EAAAD,EAAAE,aAA2BC,YAAA,QAK7BC,gBAAe,WACb,OACEC,KAAM,IAOVC,kBAAiB,WACfC,KAAKC,MAAQC,YAAYF,KAAKG,KAAM,MAMtCC,qBAAoB,WAClBJ,KAAKC,OAASI,cAAcL,KAAKC,QAYnCE,KAAI,WAMFH,KAAKM,UAAUR,KAAME,KAAKO,MAAMT,KAAO,KAMzCU,OAAM,WACJ,MAAOf,GAAAgB,cAAA,MAAI,KAAC,SAAOT,KAAKO,MAAMT,QAIlCL,GAAMe,OACJf,EAAAgB,cAACf,EAAK,MACNgB,SAASC,eAAe,eDcpBC;;;AAIA,SAAStB,GEzEfA,EAAAC,QAAA","file":"3.bundle.js","sourcesContent":["webpackJsonp([3],{\n\n/***/ 5:\n/*!*************************!*\\\n !*** ./demo3/demo3.jsx ***!\n \\*************************/\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar React = __webpack_require__(/*! react */ 1);\n\t\n\tvar Timer = React.createClass({displayName: 'Timer',\n\t // In addition to properties passed from parents, React\n\t // components can also contain an internal state, referenced\n\t // by `this.state`. `getInitialState` defines the value of\n\t // `this.state` when the component is first mounted.\n\t getInitialState:function() {\n\t return {\n\t time: 0\n\t };\n\t },\n\t\n\t // React provides lifecycle hooks to set up and tear\n\t // down components and third-party APIs if necessary.\n\t // Here, we start a timer when the component mounts...\n\t componentDidMount:function() {\n\t this.timer = setInterval(this.tick, 1000);\n\t },\n\t\n\t // ... and remove the timer when the component unmounts.\n\t // If we don't do this, we'll leak memory (and the timer\n\t // will continue to fire).\n\t componentWillUnmount:function() {\n\t this.timer && clearInterval(this.timer);\n\t },\n\t\n\t // Unlike properties, state is owned by the component, and\n\t // can be changed using a few methods. Note that you should\n\t // *never* modify `this.state` directly--always use an API\n\t // method to mutate the state.\n\t //\n\t // Our timer calls `setState`, which allows us to update one or\n\t // more keys in our state. The object passed to `setState` is\n\t // merged with the current state; we can use `replaceState` instead\n\t // if we don't want to merge.\n\t tick:function() {\n\t // Note that React auto-binds all top-level methods in the\n\t // object passed to `createClass` to the component instance.\n\t // Because of this, `this` inside the `tick` method is\n\t // automatically the component instance, and we didn't have\n\t // to use `this.tick.bind(this)` inside the `setInterval` call.\n\t this.setState({time: this.state.time + 1});\n\t },\n\t\n\t // Render is called automatically when a component's state is\n\t // updated with `setState`, `replaceState`, or when `forceUpdate`\n\t // is called. Composed components are automatically re-rendered.\n\t render:function() {\n\t return React.createElement(\"div\", null, \"Time: \", this.state.time);\n\t }\n\t});\n\t\n\tReact.render(\n\t React.createElement(Timer, null),\n\t document.getElementById(\"container\")\n\t);\n\n\n/***/ },\n\n/***/ 12:\n/*!****************************************!*\\\n !*** ./~/raw-loader!./demo3/demo3.jsx ***!\n \\****************************************/\n/***/ function(module, exports, __webpack_require__) {\n\n\tmodule.exports = \"var React = require(\\\"react\\\");\\n\\nvar Timer = React.createClass({\\n // In addition to properties passed from parents, React\\n // components can also contain an internal state, referenced\\n // by `this.state`. `getInitialState` defines the value of\\n // `this.state` when the component is first mounted.\\n getInitialState() {\\n return {\\n time: 0\\n };\\n },\\n\\n // React provides lifecycle hooks to set up and tear\\n // down components and third-party APIs if necessary.\\n // Here, we start a timer when the component mounts...\\n componentDidMount() {\\n this.timer = setInterval(this.tick, 1000);\\n },\\n\\n // ... and remove the timer when the component unmounts.\\n // If we don't do this, we'll leak memory (and the timer\\n // will continue to fire).\\n componentWillUnmount() {\\n this.timer && clearInterval(this.timer);\\n },\\n\\n // Unlike properties, state is owned by the component, and\\n // can be changed using a few methods. Note that you should\\n // *never* modify `this.state` directly--always use an API\\n // method to mutate the state.\\n //\\n // Our timer calls `setState`, which allows us to update one or\\n // more keys in our state. The object passed to `setState` is\\n // merged with the current state; we can use `replaceState` instead\\n // if we don't want to merge.\\n tick() {\\n // Note that React auto-binds all top-level methods in the\\n // object passed to `createClass` to the component instance.\\n // Because of this, `this` inside the `tick` method is\\n // automatically the component instance, and we didn't have\\n // to use `this.tick.bind(this)` inside the `setInterval` call.\\n this.setState({time: this.state.time + 1});\\n },\\n\\n // Render is called automatically when a component's state is\\n // updated with `setState`, `replaceState`, or when `forceUpdate`\\n // is called. Composed components are automatically re-rendered.\\n render() {\\n return
Time: {this.state.time}
;\\n }\\n});\\n\\nReact.render(\\n ,\\n document.getElementById(\\\"container\\\")\\n);\\n\"\n\n/***/ }\n\n});\n\n\n/** WEBPACK FOOTER **\n ** 3.bundle.js\n **/","var React = require(\"react\");\n\nvar Timer = React.createClass({\n // In addition to properties passed from parents, React\n // components can also contain an internal state, referenced\n // by `this.state`. `getInitialState` defines the value of\n // `this.state` when the component is first mounted.\n getInitialState() {\n return {\n time: 0\n };\n },\n\n // React provides lifecycle hooks to set up and tear\n // down components and third-party APIs if necessary.\n // Here, we start a timer when the component mounts...\n componentDidMount() {\n this.timer = setInterval(this.tick, 1000);\n },\n\n // ... and remove the timer when the component unmounts.\n // If we don't do this, we'll leak memory (and the timer\n // will continue to fire).\n componentWillUnmount() {\n this.timer && clearInterval(this.timer);\n },\n\n // Unlike properties, state is owned by the component, and\n // can be changed using a few methods. Note that you should\n // *never* modify `this.state` directly--always use an API\n // method to mutate the state.\n //\n // Our timer calls `setState`, which allows us to update one or\n // more keys in our state. The object passed to `setState` is\n // merged with the current state; we can use `replaceState` instead\n // if we don't want to merge.\n tick() {\n // Note that React auto-binds all top-level methods in the\n // object passed to `createClass` to the component instance.\n // Because of this, `this` inside the `tick` method is\n // automatically the component instance, and we didn't have\n // to use `this.tick.bind(this)` inside the `setInterval` call.\n this.setState({time: this.state.time + 1});\n },\n\n // Render is called automatically when a component's state is\n // updated with `setState`, `replaceState`, or when `forceUpdate`\n // is called. Composed components are automatically re-rendered.\n render() {\n return
Time: {this.state.time}
;\n }\n});\n\nReact.render(\n ,\n document.getElementById(\"container\")\n);\n\n\n\n/** WEBPACK FOOTER **\n ** ./demo3/demo3.jsx\n **/","module.exports = \"var React = require(\\\"react\\\");\\n\\nvar Timer = React.createClass({\\n // In addition to properties passed from parents, React\\n // components can also contain an internal state, referenced\\n // by `this.state`. `getInitialState` defines the value of\\n // `this.state` when the component is first mounted.\\n getInitialState() {\\n return {\\n time: 0\\n };\\n },\\n\\n // React provides lifecycle hooks to set up and tear\\n // down components and third-party APIs if necessary.\\n // Here, we start a timer when the component mounts...\\n componentDidMount() {\\n this.timer = setInterval(this.tick, 1000);\\n },\\n\\n // ... and remove the timer when the component unmounts.\\n // If we don't do this, we'll leak memory (and the timer\\n // will continue to fire).\\n componentWillUnmount() {\\n this.timer && clearInterval(this.timer);\\n },\\n\\n // Unlike properties, state is owned by the component, and\\n // can be changed using a few methods. Note that you should\\n // *never* modify `this.state` directly--always use an API\\n // method to mutate the state.\\n //\\n // Our timer calls `setState`, which allows us to update one or\\n // more keys in our state. The object passed to `setState` is\\n // merged with the current state; we can use `replaceState` instead\\n // if we don't want to merge.\\n tick() {\\n // Note that React auto-binds all top-level methods in the\\n // object passed to `createClass` to the component instance.\\n // Because of this, `this` inside the `tick` method is\\n // automatically the component instance, and we didn't have\\n // to use `this.tick.bind(this)` inside the `setInterval` call.\\n this.setState({time: this.state.time + 1});\\n },\\n\\n // Render is called automatically when a component's state is\\n // updated with `setState`, `replaceState`, or when `forceUpdate`\\n // is called. Composed components are automatically re-rendered.\\n render() {\\n return
Time: {this.state.time}
;\\n }\\n});\\n\\nReact.render(\\n ,\\n document.getElementById(\\\"container\\\")\\n);\\n\"\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/raw-loader!./demo3/demo3.jsx\n ** module id = 12\n ** module chunks = 3\n **/"],"sourceRoot":""}
--------------------------------------------------------------------------------
/build/4.bundle.js:
--------------------------------------------------------------------------------
1 | webpackJsonp([4],{6:/*!*************************!*\
2 | !*** ./demo4/demo4.jsx ***!
3 | \*************************/
4 | function(e,t,n){var o=n(/*! react */1),a=o.createClass({displayName:"TodoList",propTypes:{items:o.PropTypes.arrayOf(o.PropTypes.string).isRequired},render:function(){return o.createElement("ul",null,this.props.items.map(function(e,t){return o.createElement("li",{key:t},e)}))}}),r=o.createClass({displayName:"TodoForm",propTypes:{onSubmit:o.PropTypes.func.isRequired},getInitialState:function(){return{text:""}},onTextChange:function(e){this.setState({text:e.target.value})},onSubmit:function(e){e.preventDefault(),this.state.text.trim()&&(this.props.onSubmit(this.state.text),this.setState({text:""}))},render:function(){return o.createElement("form",{onSubmit:this.onSubmit},o.createElement("input",{type:"text",value:this.state.text,onChange:this.onTextChange}),o.createElement("input",{type:"submit",value:"Add Todo"}))}}),i=o.createClass({displayName:"Todos",getInitialState:function(){return{items:[]}},onSubmitTodo:function(e){var t=this.state.items.concat([e]);this.setState({items:t})},render:function(){return o.createElement("div",null,o.createElement("h3",null,"TODO"),o.createElement(a,{items:this.state.items}),o.createElement(r,{onSubmit:this.onSubmitTodo}))}});o.render(o.createElement(i,null),document.getElementById("container"))},13:/*!****************************************!*\
5 | !*** ./~/raw-loader!./demo4/demo4.jsx ***!
6 | \****************************************/
7 | function(e){e.exports='var React = require("react");\n\nvar TodoList = React.createClass({\n // `TodoList` takes a prop called `items` which is an array of\n // strings. We can make this requirement "official" using propTypes.\n // If a component doesn\'t get the properties listed in its\n // propTypes, it will warn you in the console (if using a development\n // build of React).\n propTypes: {\n items: React.PropTypes.arrayOf(React.PropTypes.string).isRequired\n },\n\n render() {\n // Every component in an array should have a `key` attribute\n // set so React can uniquely identify the item if it needs\n // to remove it from the middle of the array without iterating\n // over every component in the array.\n // Since our todos can\'t be reordered, we\'ll just use the index.\n //\n // Also notice the use of another ES6 feature in the call to `map`,\n // arrow functions. The bodies of arrow functions are automatically\n // bound to the value of `this` outside of them, so no more calling\n // `.bind(this)` or `var self = this` juggling.\n return (\n
\n );\n }\n});\n\nvar TodoForm = React.createClass({\n // React has PropTypes for most built-in JS types, as well as the\n // ability to define your own validation functions.\n //\n // `TodoForm` requires an `onSubmit` property that we\'ll use to notify\n // our parent component that the form has been submitted; this makes\n // the component more reusable, since the logic for what to do with\n // the submitted form isn\'t hardcoded into the `TodoForm` component.\n propTypes: {\n onSubmit: React.PropTypes.func.isRequired\n },\n\n // `TodoForm` contains a text input with a `value` attribute, which\n // makes the input a "controlled" input. This means that the input\n // will *always* display whatever is passed to its `value` no matter\n // what the user tries to type in the box. The `text` property of\n // our state is the current string to display in the box.\n getInitialState() {\n return {\n text: ""\n };\n },\n\n // The text input has an `onChange` property, which calls a function\n // any time the user interacts with the box. Here, we update our\n // state so the text in the box updates.\n //\n // This is necessary because React components\' `render` functions should\n // *always* describe how the component should look at *any* point and time;\n // if we didn\'t use a controlled input, the text might reset in certain\n // re-rendering situations.\n onTextChange(e) {\n this.setState({text: e.target.value});\n },\n\n // The form also has a handler for `onSubmit`...\n onSubmit(e) {\n e.preventDefault();\n if (this.state.text.trim()) {\n // ... which we\'ll use to indicate to our parent that an\n // item has been submitted...\n this.props.onSubmit(this.state.text);\n // ... and then clear the text box.\n this.setState({text: ""});\n }\n },\n\n render() {\n return (\n \n );\n }\n});\n\n// Our `Todos` component is the full application, which very simply composes\n// the `TodoList` and `TodoForm` components.\nvar Todos = React.createClass({\n getInitialState() {\n // It owns the actual items array, so the composed `TodoList`\n // and `TodoForm` can be reused in many contexts (that is, they\n // are not application specific).\n return {\n items: []\n };\n },\n\n // `onSubmitTodo` is the function we pass to `TodoForm`\'s\n // `onSubmit` property; so, it will be called when `TodoForm`\n // calls `this.props.onSubmit(...)`.\n onSubmitTodo(newTodo) {\n var nextItems = this.state.items.concat([newTodo]);\n this.setState({items: nextItems});\n },\n\n render() {\n return (\n
\n
TODO
\n \n \n
\n );\n }\n});\n\nReact.render(\n ,\n document.getElementById("container")\n);\n'}});
8 | //# sourceMappingURL=4.bundle.js.map
--------------------------------------------------------------------------------
/build/4.bundle.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"sources":["webpack:///4.bundle.js","webpack:///./demo4/demo4.jsx","webpack:///./demo4/demo4.jsx?319e"],"names":["webpackJsonp",6,"module","exports","__webpack_require__","React","TodoList","createClass","displayName","propTypes","items","PropTypes","arrayOf","string","isRequired","render","createElement","this","props","map","item","index","key","TodoForm","onSubmit","func","getInitialState","text","onTextChange","e","setState","target","value","preventDefault","state","trim","type","onChange","Todos","onSubmitTodo","newTodo","nextItems","concat","document","getElementById",13],"mappings":"AAAAA,cAAc,IAERC;;;AAIA,SAASC,EAAQC,EAASC,GCNhC,GAAIC,GAAQD,cAAQ,GAEhBE,EAAAD,EAAAE,aAA8BC,YAAA,WAMhCC,WACEC,MAAOL,EAAMM,UAAUC,QAAQP,EAAMM,UAAUE,QAAQC,YAGzDC,OAAM,WAWJ,MACEV,GAAAW,cAAA,KAAG,KACFC,KAAKC,MAAMR,MAAMS,IAAI,SAACC,EAAMC,GAC3B,MAAOhB,GAAAW,cAAA,MAAGM,IAACD,GAAYD,SAO3BG,EAAAlB,EAAAE,aAA8BC,YAAA,WAQhCC,WACEe,SAAUnB,EAAMM,UAAUc,KAAKX,YAQjCY,gBAAe,WACb,OACEC,KAAM,KAYVC,aAAY,SAACC,GACXZ,KAAKa,UAAUH,KAAME,EAAEE,OAAOC,SAIhCR,SAAQ,SAACK,GACPA,EAAEI,iBACEhB,KAAKiB,MAAMP,KAAKQ,SAGlBlB,KAAKC,MAAMM,SAASP,KAAKiB,MAAMP,MAE/BV,KAAKa,UAAUH,KAAM,OAIzBZ,OAAM,WACJ,MACEV,GAAAW,cAAA,QAAKQ,SAACP,KAAUO,UACdnB,EAAAW,cAAA,SAAMoB,KAAC,OAAKJ,MAAOf,KAAOiB,MAAKP,KAAMU,SAAMpB,KAAQW,eACnDvB,EAAAW,cAAA,SAAMoB,KAAC,SAAKJ,MAAS,iBAQzBM,EAAAjC,EAAAE,aAA2BC,YAAA,QAC7BkB,gBAAe,WAIb,OACEhB,WAOJ6B,aAAY,SAACC,GACX,GAAIC,GAAYxB,KAAKiB,MAAMxB,MAAMgC,QAAQF,GACzCvB,MAAKa,UAAUpB,MAAO+B,KAGxB1B,OAAM,WACJ,MACEV,GAAAW,cAAA,MAAI,KACFX,EAAAW,cAAA,KAAG,KAAC,QACJX,EAAAW,cAACV,GAAQI,MAACO,KAAOiB,MAAKxB,QACtBL,EAAAW,cAACO,GAAQC,SAACP,KAAUsB,kBAM5BlC,GAAMU,OACJV,EAAAW,cAACsB,EAAK,MACNK,SAASC,eAAe,eDcpBC;;;AAIA,SAAS3C,GE7IfA,EAAAC,QAAA","file":"4.bundle.js","sourcesContent":["webpackJsonp([4],{\n\n/***/ 6:\n/*!*************************!*\\\n !*** ./demo4/demo4.jsx ***!\n \\*************************/\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar React = __webpack_require__(/*! react */ 1);\n\t\n\tvar TodoList = React.createClass({displayName: 'TodoList',\n\t // `TodoList` takes a prop called `items` which is an array of\n\t // strings. We can make this requirement \"official\" using propTypes.\n\t // If a component doesn't get the properties listed in its\n\t // propTypes, it will warn you in the console (if using a development\n\t // build of React).\n\t propTypes: {\n\t items: React.PropTypes.arrayOf(React.PropTypes.string).isRequired\n\t },\n\t\n\t render:function() {\n\t // Every component in an array should have a `key` attribute\n\t // set so React can uniquely identify the item if it needs\n\t // to remove it from the middle of the array without iterating\n\t // over every component in the array.\n\t // Since our todos can't be reordered, we'll just use the index.\n\t //\n\t // Also notice the use of another ES6 feature in the call to `map`,\n\t // arrow functions. The bodies of arrow functions are automatically\n\t // bound to the value of `this` outside of them, so no more calling\n\t // `.bind(this)` or `var self = this` juggling.\n\t return (\n\t React.createElement(\"ul\", null, \n\t this.props.items.map(function(item, index) {\n\t return React.createElement(\"li\", {key: index}, item);\n\t })\n\t )\n\t );\n\t }\n\t});\n\t\n\tvar TodoForm = React.createClass({displayName: 'TodoForm',\n\t // React has PropTypes for most built-in JS types, as well as the\n\t // ability to define your own validation functions.\n\t //\n\t // `TodoForm` requires an `onSubmit` property that we'll use to notify\n\t // our parent component that the form has been submitted; this makes\n\t // the component more reusable, since the logic for what to do with\n\t // the submitted form isn't hardcoded into the `TodoForm` component.\n\t propTypes: {\n\t onSubmit: React.PropTypes.func.isRequired\n\t },\n\t\n\t // `TodoForm` contains a text input with a `value` attribute, which\n\t // makes the input a \"controlled\" input. This means that the input\n\t // will *always* display whatever is passed to its `value` no matter\n\t // what the user tries to type in the box. The `text` property of\n\t // our state is the current string to display in the box.\n\t getInitialState:function() {\n\t return {\n\t text: \"\"\n\t };\n\t },\n\t\n\t // The text input has an `onChange` property, which calls a function\n\t // any time the user interacts with the box. Here, we update our\n\t // state so the text in the box updates.\n\t //\n\t // This is necessary because React components' `render` functions should\n\t // *always* describe how the component should look at *any* point and time;\n\t // if we didn't use a controlled input, the text might reset in certain\n\t // re-rendering situations.\n\t onTextChange:function(e) {\n\t this.setState({text: e.target.value});\n\t },\n\t\n\t // The form also has a handler for `onSubmit`...\n\t onSubmit:function(e) {\n\t e.preventDefault();\n\t if (this.state.text.trim()) {\n\t // ... which we'll use to indicate to our parent that an\n\t // item has been submitted...\n\t this.props.onSubmit(this.state.text);\n\t // ... and then clear the text box.\n\t this.setState({text: \"\"});\n\t }\n\t },\n\t\n\t render:function() {\n\t return (\n\t React.createElement(\"form\", {onSubmit: this.onSubmit}, \n\t React.createElement(\"input\", {type: \"text\", value: this.state.text, onChange: this.onTextChange}), \n\t React.createElement(\"input\", {type: \"submit\", value: \"Add Todo\"})\n\t )\n\t );\n\t }\n\t});\n\t\n\t// Our `Todos` component is the full application, which very simply composes\n\t// the `TodoList` and `TodoForm` components.\n\tvar Todos = React.createClass({displayName: 'Todos',\n\t getInitialState:function() {\n\t // It owns the actual items array, so the composed `TodoList`\n\t // and `TodoForm` can be reused in many contexts (that is, they\n\t // are not application specific).\n\t return {\n\t items: []\n\t };\n\t },\n\t\n\t // `onSubmitTodo` is the function we pass to `TodoForm`'s\n\t // `onSubmit` property; so, it will be called when `TodoForm`\n\t // calls `this.props.onSubmit(...)`.\n\t onSubmitTodo:function(newTodo) {\n\t var nextItems = this.state.items.concat([newTodo]);\n\t this.setState({items: nextItems});\n\t },\n\t\n\t render:function() {\n\t return (\n\t React.createElement(\"div\", null, \n\t React.createElement(\"h3\", null, \"TODO\"), \n\t React.createElement(TodoList, {items: this.state.items}), \n\t React.createElement(TodoForm, {onSubmit: this.onSubmitTodo})\n\t )\n\t );\n\t }\n\t});\n\t\n\tReact.render(\n\t React.createElement(Todos, null),\n\t document.getElementById(\"container\")\n\t);\n\n\n/***/ },\n\n/***/ 13:\n/*!****************************************!*\\\n !*** ./~/raw-loader!./demo4/demo4.jsx ***!\n \\****************************************/\n/***/ function(module, exports, __webpack_require__) {\n\n\tmodule.exports = \"var React = require(\\\"react\\\");\\n\\nvar TodoList = React.createClass({\\n // `TodoList` takes a prop called `items` which is an array of\\n // strings. We can make this requirement \\\"official\\\" using propTypes.\\n // If a component doesn't get the properties listed in its\\n // propTypes, it will warn you in the console (if using a development\\n // build of React).\\n propTypes: {\\n items: React.PropTypes.arrayOf(React.PropTypes.string).isRequired\\n },\\n\\n render() {\\n // Every component in an array should have a `key` attribute\\n // set so React can uniquely identify the item if it needs\\n // to remove it from the middle of the array without iterating\\n // over every component in the array.\\n // Since our todos can't be reordered, we'll just use the index.\\n //\\n // Also notice the use of another ES6 feature in the call to `map`,\\n // arrow functions. The bodies of arrow functions are automatically\\n // bound to the value of `this` outside of them, so no more calling\\n // `.bind(this)` or `var self = this` juggling.\\n return (\\n
\\n );\\n }\\n});\\n\\nvar TodoForm = React.createClass({\\n // React has PropTypes for most built-in JS types, as well as the\\n // ability to define your own validation functions.\\n //\\n // `TodoForm` requires an `onSubmit` property that we'll use to notify\\n // our parent component that the form has been submitted; this makes\\n // the component more reusable, since the logic for what to do with\\n // the submitted form isn't hardcoded into the `TodoForm` component.\\n propTypes: {\\n onSubmit: React.PropTypes.func.isRequired\\n },\\n\\n // `TodoForm` contains a text input with a `value` attribute, which\\n // makes the input a \\\"controlled\\\" input. This means that the input\\n // will *always* display whatever is passed to its `value` no matter\\n // what the user tries to type in the box. The `text` property of\\n // our state is the current string to display in the box.\\n getInitialState() {\\n return {\\n text: \\\"\\\"\\n };\\n },\\n\\n // The text input has an `onChange` property, which calls a function\\n // any time the user interacts with the box. Here, we update our\\n // state so the text in the box updates.\\n //\\n // This is necessary because React components' `render` functions should\\n // *always* describe how the component should look at *any* point and time;\\n // if we didn't use a controlled input, the text might reset in certain\\n // re-rendering situations.\\n onTextChange(e) {\\n this.setState({text: e.target.value});\\n },\\n\\n // The form also has a handler for `onSubmit`...\\n onSubmit(e) {\\n e.preventDefault();\\n if (this.state.text.trim()) {\\n // ... which we'll use to indicate to our parent that an\\n // item has been submitted...\\n this.props.onSubmit(this.state.text);\\n // ... and then clear the text box.\\n this.setState({text: \\\"\\\"});\\n }\\n },\\n\\n render() {\\n return (\\n \\n );\\n }\\n});\\n\\n// Our `Todos` component is the full application, which very simply composes\\n// the `TodoList` and `TodoForm` components.\\nvar Todos = React.createClass({\\n getInitialState() {\\n // It owns the actual items array, so the composed `TodoList`\\n // and `TodoForm` can be reused in many contexts (that is, they\\n // are not application specific).\\n return {\\n items: []\\n };\\n },\\n\\n // `onSubmitTodo` is the function we pass to `TodoForm`'s\\n // `onSubmit` property; so, it will be called when `TodoForm`\\n // calls `this.props.onSubmit(...)`.\\n onSubmitTodo(newTodo) {\\n var nextItems = this.state.items.concat([newTodo]);\\n this.setState({items: nextItems});\\n },\\n\\n render() {\\n return (\\n
\\n
TODO
\\n \\n \\n
\\n );\\n }\\n});\\n\\nReact.render(\\n ,\\n document.getElementById(\\\"container\\\")\\n);\\n\"\n\n/***/ }\n\n});\n\n\n/** WEBPACK FOOTER **\n ** 4.bundle.js\n **/","var React = require(\"react\");\n\nvar TodoList = React.createClass({\n // `TodoList` takes a prop called `items` which is an array of\n // strings. We can make this requirement \"official\" using propTypes.\n // If a component doesn't get the properties listed in its\n // propTypes, it will warn you in the console (if using a development\n // build of React).\n propTypes: {\n items: React.PropTypes.arrayOf(React.PropTypes.string).isRequired\n },\n\n render() {\n // Every component in an array should have a `key` attribute\n // set so React can uniquely identify the item if it needs\n // to remove it from the middle of the array without iterating\n // over every component in the array.\n // Since our todos can't be reordered, we'll just use the index.\n //\n // Also notice the use of another ES6 feature in the call to `map`,\n // arrow functions. The bodies of arrow functions are automatically\n // bound to the value of `this` outside of them, so no more calling\n // `.bind(this)` or `var self = this` juggling.\n return (\n
\n );\n }\n});\n\nvar TodoForm = React.createClass({\n // React has PropTypes for most built-in JS types, as well as the\n // ability to define your own validation functions.\n //\n // `TodoForm` requires an `onSubmit` property that we'll use to notify\n // our parent component that the form has been submitted; this makes\n // the component more reusable, since the logic for what to do with\n // the submitted form isn't hardcoded into the `TodoForm` component.\n propTypes: {\n onSubmit: React.PropTypes.func.isRequired\n },\n\n // `TodoForm` contains a text input with a `value` attribute, which\n // makes the input a \"controlled\" input. This means that the input\n // will *always* display whatever is passed to its `value` no matter\n // what the user tries to type in the box. The `text` property of\n // our state is the current string to display in the box.\n getInitialState() {\n return {\n text: \"\"\n };\n },\n\n // The text input has an `onChange` property, which calls a function\n // any time the user interacts with the box. Here, we update our\n // state so the text in the box updates.\n //\n // This is necessary because React components' `render` functions should\n // *always* describe how the component should look at *any* point and time;\n // if we didn't use a controlled input, the text might reset in certain\n // re-rendering situations.\n onTextChange(e) {\n this.setState({text: e.target.value});\n },\n\n // The form also has a handler for `onSubmit`...\n onSubmit(e) {\n e.preventDefault();\n if (this.state.text.trim()) {\n // ... which we'll use to indicate to our parent that an\n // item has been submitted...\n this.props.onSubmit(this.state.text);\n // ... and then clear the text box.\n this.setState({text: \"\"});\n }\n },\n\n render() {\n return (\n \n );\n }\n});\n\n// Our `Todos` component is the full application, which very simply composes\n// the `TodoList` and `TodoForm` components.\nvar Todos = React.createClass({\n getInitialState() {\n // It owns the actual items array, so the composed `TodoList`\n // and `TodoForm` can be reused in many contexts (that is, they\n // are not application specific).\n return {\n items: []\n };\n },\n\n // `onSubmitTodo` is the function we pass to `TodoForm`'s\n // `onSubmit` property; so, it will be called when `TodoForm`\n // calls `this.props.onSubmit(...)`.\n onSubmitTodo(newTodo) {\n var nextItems = this.state.items.concat([newTodo]);\n this.setState({items: nextItems});\n },\n\n render() {\n return (\n
\n
TODO
\n \n \n
\n );\n }\n});\n\nReact.render(\n ,\n document.getElementById(\"container\")\n);\n\n\n\n/** WEBPACK FOOTER **\n ** ./demo4/demo4.jsx\n **/","module.exports = \"var React = require(\\\"react\\\");\\n\\nvar TodoList = React.createClass({\\n // `TodoList` takes a prop called `items` which is an array of\\n // strings. We can make this requirement \\\"official\\\" using propTypes.\\n // If a component doesn't get the properties listed in its\\n // propTypes, it will warn you in the console (if using a development\\n // build of React).\\n propTypes: {\\n items: React.PropTypes.arrayOf(React.PropTypes.string).isRequired\\n },\\n\\n render() {\\n // Every component in an array should have a `key` attribute\\n // set so React can uniquely identify the item if it needs\\n // to remove it from the middle of the array without iterating\\n // over every component in the array.\\n // Since our todos can't be reordered, we'll just use the index.\\n //\\n // Also notice the use of another ES6 feature in the call to `map`,\\n // arrow functions. The bodies of arrow functions are automatically\\n // bound to the value of `this` outside of them, so no more calling\\n // `.bind(this)` or `var self = this` juggling.\\n return (\\n
\\n );\\n }\\n});\\n\\nvar TodoForm = React.createClass({\\n // React has PropTypes for most built-in JS types, as well as the\\n // ability to define your own validation functions.\\n //\\n // `TodoForm` requires an `onSubmit` property that we'll use to notify\\n // our parent component that the form has been submitted; this makes\\n // the component more reusable, since the logic for what to do with\\n // the submitted form isn't hardcoded into the `TodoForm` component.\\n propTypes: {\\n onSubmit: React.PropTypes.func.isRequired\\n },\\n\\n // `TodoForm` contains a text input with a `value` attribute, which\\n // makes the input a \\\"controlled\\\" input. This means that the input\\n // will *always* display whatever is passed to its `value` no matter\\n // what the user tries to type in the box. The `text` property of\\n // our state is the current string to display in the box.\\n getInitialState() {\\n return {\\n text: \\\"\\\"\\n };\\n },\\n\\n // The text input has an `onChange` property, which calls a function\\n // any time the user interacts with the box. Here, we update our\\n // state so the text in the box updates.\\n //\\n // This is necessary because React components' `render` functions should\\n // *always* describe how the component should look at *any* point and time;\\n // if we didn't use a controlled input, the text might reset in certain\\n // re-rendering situations.\\n onTextChange(e) {\\n this.setState({text: e.target.value});\\n },\\n\\n // The form also has a handler for `onSubmit`...\\n onSubmit(e) {\\n e.preventDefault();\\n if (this.state.text.trim()) {\\n // ... which we'll use to indicate to our parent that an\\n // item has been submitted...\\n this.props.onSubmit(this.state.text);\\n // ... and then clear the text box.\\n this.setState({text: \\\"\\\"});\\n }\\n },\\n\\n render() {\\n return (\\n \\n );\\n }\\n});\\n\\n// Our `Todos` component is the full application, which very simply composes\\n// the `TodoList` and `TodoForm` components.\\nvar Todos = React.createClass({\\n getInitialState() {\\n // It owns the actual items array, so the composed `TodoList`\\n // and `TodoForm` can be reused in many contexts (that is, they\\n // are not application specific).\\n return {\\n items: []\\n };\\n },\\n\\n // `onSubmitTodo` is the function we pass to `TodoForm`'s\\n // `onSubmit` property; so, it will be called when `TodoForm`\\n // calls `this.props.onSubmit(...)`.\\n onSubmitTodo(newTodo) {\\n var nextItems = this.state.items.concat([newTodo]);\\n this.setState({items: nextItems});\\n },\\n\\n render() {\\n return (\\n
\\n
TODO
\\n \\n \\n
\\n );\\n }\\n});\\n\\nReact.render(\\n ,\\n document.getElementById(\\\"container\\\")\\n);\\n\"\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/raw-loader!./demo4/demo4.jsx\n ** module id = 13\n ** module chunks = 4\n **/"],"sourceRoot":""}
--------------------------------------------------------------------------------
/build/5.bundle.js:
--------------------------------------------------------------------------------
1 | webpackJsonp([5],{7:/*!*************************!*\
2 | !*** ./demo5/demo5.jsx ***!
3 | \*************************/
4 | function(e,t,n){var o=n(/*! react */1),a={componentWillMount:function(){this.intervals=[]},setInterval:function(){this.intervals.push(setInterval.apply(null,arguments))},componentWillUnmount:function(){this.intervals.forEach(clearInterval)}},i=o.createClass({displayName:"Timer",mixins:[a],getInitialState:function(){return{time:0}},componentDidMount:function(){this.setInterval(this.tick,1e3)},tick:function(){this.setState({time:this.state.time+1})},render:function(){return o.createElement("div",null,"Time: ",this.state.time)}});o.render(o.createElement(i,null),document.getElementById("container"))},14:/*!****************************************!*\
5 | !*** ./~/raw-loader!./demo5/demo5.jsx ***!
6 | \****************************************/
7 | function(e){e.exports='var React = require("react");\n\n// While composition is the best technique for using components\n// together, sometimes it\'s desirable to have cross-cutting concerns\n// that are shared between multiple components. React uses mixins\n// to solve this problem.\n\n// A mixin is simply an object that defines certain component\n// lifecycle hooks and properties. Here\'s a mixin we\'ll use\n// to reimplement the Timer demo.\nvar SetIntervalMixin = {\n // Many lifecycle hooks are automatically merged with the\n // same hook defined in other mixins or the component itself.\n componentWillMount() {\n this.intervals = [];\n },\n\n // Mixins can also define other methods to make available\n // to the component.\n setInterval() {\n this.intervals.push(setInterval.apply(null, arguments));\n },\n\n componentWillUnmount() {\n this.intervals.forEach(clearInterval);\n }\n};\n\nvar Timer = React.createClass({\n // Use a mixin by adding it to the `mixins` array for a component.\n mixins: [SetIntervalMixin],\n\n getInitialState() {\n return {\n time: 0\n };\n },\n\n // Now we can use the mixin to set the interval without worrying\n // about setting our own `componentWillUnmount` hook.\n componentDidMount() {\n this.setInterval(this.tick, 1000);\n },\n\n tick() {\n this.setState({time: this.state.time + 1});\n },\n\n render() {\n return
Time: {this.state.time}
;\n }\n});\n\nReact.render(\n ,\n document.getElementById("container")\n);\n'}});
8 | //# sourceMappingURL=5.bundle.js.map
--------------------------------------------------------------------------------
/build/5.bundle.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"sources":["webpack:///5.bundle.js","webpack:///./demo5/demo5.jsx","webpack:///./demo5/demo5.jsx?b0b1"],"names":["webpackJsonp",7,"module","exports","__webpack_require__","React","SetIntervalMixin","componentWillMount","this","intervals","setInterval","push","apply","arguments","componentWillUnmount","forEach","clearInterval","Timer","createClass","displayName","mixins","getInitialState","time","componentDidMount","tick","setState","state","render","createElement","document","getElementById",14],"mappings":"AAAAA,cAAc,IAERC;;;AAIA,SAASC,EAAQC,EAASC,GCNhC,GAAIC,GAAQD,cAAQ,GAUhBE,GAGFC,mBAAkB,WAChBC,KAAKC,cAKPC,YAAW,WACTF,KAAKC,UAAUE,KAAKD,YAAYE,MAAM,KAAMC,aAG9CC,qBAAoB,WAClBN,KAAKC,UAAUM,QAAQC,iBAIvBC,EAAAZ,EAAAa,aAA2BC,YAAA,QAE7BC,QAASd,GAETe,gBAAe,WACb,OACEC,KAAM,IAMVC,kBAAiB,WACff,KAAKE,YAAYF,KAAKgB,KAAM,MAG9BA,KAAI,WACFhB,KAAKiB,UAAUH,KAAMd,KAAKkB,MAAMJ,KAAO,KAGzCK,OAAM,WACJ,MAAOtB,GAAAuB,cAAA,MAAI,KAAC,SAAOpB,KAAKkB,MAAMJ,QAIlCjB,GAAMsB,OACJtB,EAAAuB,cAACX,EAAK,MACNY,SAASC,eAAe,eDcpBC;;;AAIA,SAAS7B,GEzEfA,EAAAC,QAAA","file":"5.bundle.js","sourcesContent":["webpackJsonp([5],{\n\n/***/ 7:\n/*!*************************!*\\\n !*** ./demo5/demo5.jsx ***!\n \\*************************/\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar React = __webpack_require__(/*! react */ 1);\n\t\n\t// While composition is the best technique for using components\n\t// together, sometimes it's desirable to have cross-cutting concerns\n\t// that are shared between multiple components. React uses mixins\n\t// to solve this problem.\n\t\n\t// A mixin is simply an object that defines certain component\n\t// lifecycle hooks and properties. Here's a mixin we'll use\n\t// to reimplement the Timer demo.\n\tvar SetIntervalMixin = {\n\t // Many lifecycle hooks are automatically merged with the\n\t // same hook defined in other mixins or the component itself.\n\t componentWillMount:function() {\n\t this.intervals = [];\n\t },\n\t\n\t // Mixins can also define other methods to make available\n\t // to the component.\n\t setInterval:function() {\n\t this.intervals.push(setInterval.apply(null, arguments));\n\t },\n\t\n\t componentWillUnmount:function() {\n\t this.intervals.forEach(clearInterval);\n\t }\n\t};\n\t\n\tvar Timer = React.createClass({displayName: 'Timer',\n\t // Use a mixin by adding it to the `mixins` array for a component.\n\t mixins: [SetIntervalMixin],\n\t\n\t getInitialState:function() {\n\t return {\n\t time: 0\n\t };\n\t },\n\t\n\t // Now we can use the mixin to set the interval without worrying\n\t // about setting our own `componentWillUnmount` hook.\n\t componentDidMount:function() {\n\t this.setInterval(this.tick, 1000);\n\t },\n\t\n\t tick:function() {\n\t this.setState({time: this.state.time + 1});\n\t },\n\t\n\t render:function() {\n\t return React.createElement(\"div\", null, \"Time: \", this.state.time);\n\t }\n\t});\n\t\n\tReact.render(\n\t React.createElement(Timer, null),\n\t document.getElementById(\"container\")\n\t);\n\n\n/***/ },\n\n/***/ 14:\n/*!****************************************!*\\\n !*** ./~/raw-loader!./demo5/demo5.jsx ***!\n \\****************************************/\n/***/ function(module, exports, __webpack_require__) {\n\n\tmodule.exports = \"var React = require(\\\"react\\\");\\n\\n// While composition is the best technique for using components\\n// together, sometimes it's desirable to have cross-cutting concerns\\n// that are shared between multiple components. React uses mixins\\n// to solve this problem.\\n\\n// A mixin is simply an object that defines certain component\\n// lifecycle hooks and properties. Here's a mixin we'll use\\n// to reimplement the Timer demo.\\nvar SetIntervalMixin = {\\n // Many lifecycle hooks are automatically merged with the\\n // same hook defined in other mixins or the component itself.\\n componentWillMount() {\\n this.intervals = [];\\n },\\n\\n // Mixins can also define other methods to make available\\n // to the component.\\n setInterval() {\\n this.intervals.push(setInterval.apply(null, arguments));\\n },\\n\\n componentWillUnmount() {\\n this.intervals.forEach(clearInterval);\\n }\\n};\\n\\nvar Timer = React.createClass({\\n // Use a mixin by adding it to the `mixins` array for a component.\\n mixins: [SetIntervalMixin],\\n\\n getInitialState() {\\n return {\\n time: 0\\n };\\n },\\n\\n // Now we can use the mixin to set the interval without worrying\\n // about setting our own `componentWillUnmount` hook.\\n componentDidMount() {\\n this.setInterval(this.tick, 1000);\\n },\\n\\n tick() {\\n this.setState({time: this.state.time + 1});\\n },\\n\\n render() {\\n return
Time: {this.state.time}
;\\n }\\n});\\n\\nReact.render(\\n ,\\n document.getElementById(\\\"container\\\")\\n);\\n\"\n\n/***/ }\n\n});\n\n\n/** WEBPACK FOOTER **\n ** 5.bundle.js\n **/","var React = require(\"react\");\n\n// While composition is the best technique for using components\n// together, sometimes it's desirable to have cross-cutting concerns\n// that are shared between multiple components. React uses mixins\n// to solve this problem.\n\n// A mixin is simply an object that defines certain component\n// lifecycle hooks and properties. Here's a mixin we'll use\n// to reimplement the Timer demo.\nvar SetIntervalMixin = {\n // Many lifecycle hooks are automatically merged with the\n // same hook defined in other mixins or the component itself.\n componentWillMount() {\n this.intervals = [];\n },\n\n // Mixins can also define other methods to make available\n // to the component.\n setInterval() {\n this.intervals.push(setInterval.apply(null, arguments));\n },\n\n componentWillUnmount() {\n this.intervals.forEach(clearInterval);\n }\n};\n\nvar Timer = React.createClass({\n // Use a mixin by adding it to the `mixins` array for a component.\n mixins: [SetIntervalMixin],\n\n getInitialState() {\n return {\n time: 0\n };\n },\n\n // Now we can use the mixin to set the interval without worrying\n // about setting our own `componentWillUnmount` hook.\n componentDidMount() {\n this.setInterval(this.tick, 1000);\n },\n\n tick() {\n this.setState({time: this.state.time + 1});\n },\n\n render() {\n return
Time: {this.state.time}
;\n }\n});\n\nReact.render(\n ,\n document.getElementById(\"container\")\n);\n\n\n\n/** WEBPACK FOOTER **\n ** ./demo5/demo5.jsx\n **/","module.exports = \"var React = require(\\\"react\\\");\\n\\n// While composition is the best technique for using components\\n// together, sometimes it's desirable to have cross-cutting concerns\\n// that are shared between multiple components. React uses mixins\\n// to solve this problem.\\n\\n// A mixin is simply an object that defines certain component\\n// lifecycle hooks and properties. Here's a mixin we'll use\\n// to reimplement the Timer demo.\\nvar SetIntervalMixin = {\\n // Many lifecycle hooks are automatically merged with the\\n // same hook defined in other mixins or the component itself.\\n componentWillMount() {\\n this.intervals = [];\\n },\\n\\n // Mixins can also define other methods to make available\\n // to the component.\\n setInterval() {\\n this.intervals.push(setInterval.apply(null, arguments));\\n },\\n\\n componentWillUnmount() {\\n this.intervals.forEach(clearInterval);\\n }\\n};\\n\\nvar Timer = React.createClass({\\n // Use a mixin by adding it to the `mixins` array for a component.\\n mixins: [SetIntervalMixin],\\n\\n getInitialState() {\\n return {\\n time: 0\\n };\\n },\\n\\n // Now we can use the mixin to set the interval without worrying\\n // about setting our own `componentWillUnmount` hook.\\n componentDidMount() {\\n this.setInterval(this.tick, 1000);\\n },\\n\\n tick() {\\n this.setState({time: this.state.time + 1});\\n },\\n\\n render() {\\n return
Time: {this.state.time}
;\\n }\\n});\\n\\nReact.render(\\n ,\\n document.getElementById(\\\"container\\\")\\n);\\n\"\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/raw-loader!./demo5/demo5.jsx\n ** module id = 14\n ** module chunks = 5\n **/"],"sourceRoot":""}
--------------------------------------------------------------------------------
/build/6.bundle.js:
--------------------------------------------------------------------------------
1 | webpackJsonp([6],{8:/*!*************************!*\
2 | !*** ./demo6/demo6.jsx ***!
3 | \*************************/
4 | function(e,t,n){function r(){for(var e=Math.floor(16777215*Math.random()).toString(16);e.length<6;)e="0"+e;return"#"+e}var i=n(/*! react */1),o=n(/*! ./store.jsx */29),s=n(/*! ./item.jsx */30);n(/*! ./demo6.less */68);var a=new o,c=function(e,t){return a.addItem(e,t)},l=function(e){return a.removeItem(e)},u=function(e,t,n){return a.changeItem(e,t,n)},h=function(){return a.clearItems()},d=i.createClass({displayName:"Application",handleItemChange:function(e,t,n){u(e,t,n)},handleRemoveItem:function(e){l(e)},addItem:function(){c(r(),Math.floor(800*Math.random()+200))},addManyItems:function(){for(var e=0;1e3>e;e++)this.addItem()},clearItems:function(){h()},render:function(){return i.createElement("div",null,i.createElement("div",null,i.createElement("button",{onClick:this.addItem},"Add New Item"),i.createElement("button",{onClick:this.addManyItems},"Add Many Items"),i.createElement("button",{onClick:this.clearItems},"Remove All Items")),this.props.items.map(function(e){return i.createElement(s,{color:e.color,width:e.width,id:e.id,key:e.id,onChange:this.handleItemChange,onRemove:this.handleRemoveItem})}.bind(this)))}}),m=function(){i.render(i.createElement(d,{items:a.items}),document.getElementById("container"))};a.on("change",m),m()},15:/*!****************************************!*\
5 | !*** ./~/raw-loader!./demo6/demo6.jsx ***!
6 | \****************************************/
7 | function(e){e.exports='var React = require("react"),\n Store = require("./store.jsx"),\n Item = require("./item.jsx");\n\nrequire("./demo6.less");\n\n// This demo introduces the idea of a top-level data store\n// that the main application uses to get data from;\n// any time the store updates, it triggers a "change"\n// event and the `Application` component gets re-rendered.\n//\n// Because React uses a fast virtual DOM under the hood, the\n// actual DOM doesn\'t get changed unless the output of the `render`\n// function for a component actually results in different output.\n\n// Take a look at `store.jsx` for details on the Store class;\n// then, continue reading.\nvar store = new Store();\n\n// Here are a few utility functions which help us abstract away\n// the store API from the `Application` component.\nvar addItem = (color, width) => store.addItem(color, width);\nvar removeItem = (itemId) => store.removeItem(itemId);\nvar changeItem = (itemId, color, width) => store.changeItem(itemId, color, width);\nvar clearItems = () => store.clearItems();\n\nfunction randomColor() {\n var hex = Math.floor(Math.random() * 16777215).toString(16);\n while (hex.length < 6) {\n hex = "0" + hex;\n }\n return "#" + hex;\n}\n\nvar Application = React.createClass({\n handleItemChange(itemId, color, width) {\n changeItem(itemId, color, width);\n },\n\n handleRemoveItem(itemId) {\n removeItem(itemId);\n },\n\n addItem() {\n addItem(randomColor(), Math.floor(Math.random() * 800 + 200));\n },\n\n addManyItems() {\n for (var i = 0; i < 1000; i++) {\n this.addItem();\n }\n },\n\n clearItems() {\n clearItems();\n },\n\n render() {\n // For each item in the `items` property, we render\n // an `Item` component. Notice each one has a `key` of the item\'s\n // ID, since the items can be removed from inside the middle\n // of the array.\n //\n // Take a look at `item.jsx` to see how the Item component\n // is implemented, including the ability to do fast updates\n // via `shouldComponentUpdate`.\n return (\n
\n );\n }\n});\n\nvar renderApp = () => {\n // When we render the application, we pass the store\'s\n // data via the `items` property.\n React.render(\n ,\n document.getElementById("container")\n );\n}\n\n// Any time the store emits a change event, we re-render\n// the application; React is smart enough to reuse the existing\n// component and simply pass it the new properties.\nstore.on("change", renderApp);\nrenderApp();\n'},16:/*!****************************************!*\
8 | !*** ./~/raw-loader!./demo6/store.jsx ***!
9 | \****************************************/
10 | function(e){e.exports='var EventEmitter = require("events").EventEmitter,\n util = require("util");\n\nvar id = 1;\n\n// The store simply keeps track of an array of items. Each item\n// has an id, a color, and a width.\n//\n// Notice we\'re using another ES6 feature, classes.\nclass Store extends EventEmitter {\n constructor() {\n super();\n this.items = [];\n this.itemsById = {};\n this.addItem("red", 300);\n }\n\n // Any time an item is added, removed, or changed,\n // we emit a "change" event, which is used in the React component.\n addItem(color, width) {\n var item = {id: ++id, color: color, width: width};\n this.items.push(item);\n this.itemsById[id] = item;\n this.emit("change");\n }\n\n removeItem(itemId) {\n var item = this.itemsById[itemId],\n index = this.items.indexOf(item);\n if (index > -1) {\n this.items.splice(index, 1);\n delete this.itemsById[itemId];\n this.emit("change");\n }\n }\n\n changeItem(itemId, color, width) {\n var item = this.itemsById[itemId];\n item.color = color;\n item.width = width;\n this.emit("change");\n }\n\n clearItems() {\n this.items = [];\n this.itemsById = {};\n this.emit("change");\n }\n}\n\nmodule.exports = Store;\n'},17:/*!***************************************!*\
11 | !*** ./~/raw-loader!./demo6/item.jsx ***!
12 | \***************************************/
13 | function(e){e.exports='var React = require("react");\n\nvar Item = React.createClass({\n propTypes: {\n onChange: React.PropTypes.func,\n onRemove: React.PropTypes.func,\n id: React.PropTypes.number.isRequired,\n color: React.PropTypes.string.isRequired,\n width: React.PropTypes.number.isRequired\n },\n\n // If any properties are not required, you can specify\n // default properties for them with `getDefaultProps`.\n // Note this function is only evaluated once when the ReactComponent class\n // is defined (and is cached for future instances of that same component).\n getDefaultProps() {\n return {\n onChange: function() {},\n onRemove: function() {}\n };\n },\n\n // React provides a `shouldComponentUpdate` hook that allows\n // you to return `false` if you know for sure your component\n // (and its children) will not need to be updated. You can use\n // the current and incoming state and props to make this decision.\n // For example, to only re-render if the props or state have changed\n // (based on a shallow check), you could use:\n //\n // shouldComponentUpdate(nextProps, nextState) {\n // return !shallowEqual(this.props, nextProps) ||\n // !shallowEqual(this.state, nextState);\n // },\n //\n // If a component doesn\'t re-render due to `shouldComponentUpdate`\n // returning false, none of its children will re-render either.\n\n // `PureRenderMixin` is an implementation of the `shallowEqual`\n // example above. Comment this line out to see how much slower\n // editing items in the UI is with a large number of items;\n // that\'s because React is calling `render` on every `Item`\n // component to figure out if it needs to update; it\'s much\n // faster to use `shouldComponentUpdate` (or this mixin).\n mixins: [React.addons.PureRenderMixin],\n\n // All changes to the item are delegated to the parent via properties.\n handleColorChange(e) {\n this.props.onChange(this.props.id, e.target.value, this.props.width);\n },\n\n handleWidthChange(e) {\n var width = ~~e.target.value;\n this.props.onChange(this.props.id, this.props.color, width);\n },\n\n handleRemoveClick() {\n this.props.onRemove(this.props.id);\n },\n\n render() {\n // The special `style` property on React.DOM-based ReactElements\n // allows you to specify styles as a hash. Another common property\n // is `className`, which allows you to specify a string to use\n // for the element\'s `class` attribute.\n var style = {\n background: this.props.color,\n width: this.props.width\n };\n\n // Notice all inputs are controlled inputs; that is to say,\n // their value is "locked in" to whatever `this.props.color`\n // or `this.props.width` is. It\'s only because the\n // `onChange` handlers delegate to functions that cause a\n // re-render with different properties that the inputs\n // are actually editable.\n return (\n
\n
\n \n
\n
\n \n
\n
{this.props.width}
\n
\n \n
\n
\n );\n }\n});\n\nmodule.exports = Item;\n'},29:/*!*************************!*\
14 | !*** ./demo6/store.jsx ***!
15 | \*************************/
16 | function(e,t,n){function r(){"use strict";i.call(this),this.items=[],this.itemsById={},this.addItem("red",300)}var i=n(/*! events */71).EventEmitter,o=(n(/*! util */72),1);for(var s in i)i.hasOwnProperty(s)&&(r[s]=i[s]);var a=null===i?null:i.prototype;r.prototype=Object.create(a),r.prototype.constructor=r,r.__superConstructor__=i,r.prototype.addItem=function(e,t){"use strict";var n={id:++o,color:e,width:t};this.items.push(n),this.itemsById[o]=n,this.emit("change")},r.prototype.removeItem=function(e){"use strict";var t=this.itemsById[e],n=this.items.indexOf(t);n>-1&&(this.items.splice(n,1),delete this.itemsById[e],this.emit("change"))},r.prototype.changeItem=function(e,t,n){"use strict";var r=this.itemsById[e];r.color=t,r.width=n,this.emit("change")},r.prototype.clearItems=function(){"use strict";this.items=[],this.itemsById={},this.emit("change")},e.exports=r},30:/*!************************!*\
17 | !*** ./demo6/item.jsx ***!
18 | \************************/
19 | function(e,t,n){var r=n(/*! react */1),i=r.createClass({displayName:"Item",propTypes:{onChange:r.PropTypes.func,onRemove:r.PropTypes.func,id:r.PropTypes.number.isRequired,color:r.PropTypes.string.isRequired,width:r.PropTypes.number.isRequired},getDefaultProps:function(){return{onChange:function(){},onRemove:function(){}}},mixins:[r.addons.PureRenderMixin],handleColorChange:function(e){this.props.onChange(this.props.id,e.target.value,this.props.width)},handleWidthChange:function(e){var t=~~e.target.value;this.props.onChange(this.props.id,this.props.color,t)},handleRemoveClick:function(){this.props.onRemove(this.props.id)},render:function(){var e={background:this.props.color,width:this.props.width};return r.createElement("div",{style:e,className:"item"},r.createElement("div",null,r.createElement("input",{type:"text",value:this.props.color,onChange:this.handleColorChange})),r.createElement("div",null,r.createElement("input",{type:"range",min:200,max:1e3,value:this.props.width,onChange:this.handleWidthChange})),r.createElement("div",null,this.props.width),r.createElement("div",null,r.createElement("button",{onClick:this.handleRemoveClick},"Remove")))}});e.exports=i},68:/*!**************************!*\
20 | !*** ./demo6/demo6.less ***!
21 | \**************************/
22 | function(e,t,n){var r=n(/*! !./~/css-loader!./~/less-loader!./demo6/demo6.less */69);"string"==typeof r&&(r=[[e.id,r,""]]);n(/*! ./~/style-loader/addStyles.js */70)(r)},69:/*!*********************************************************!*\
23 | !*** ./~/css-loader!./~/less-loader!./demo6/demo6.less ***!
24 | \*********************************************************/
25 | function(e,t,n){t=e.exports=n(/*! ./~/css-loader/cssToString.js */127)(),t.push([e.id,".item{border:1px solid #000;height:70px;display:block;padding:20px;margin:10px 0}",""])},70:/*!*************************************!*\
26 | !*** ./~/style-loader/addStyles.js ***!
27 | \*************************************/
28 | function(e){function t(e){for(var t=0;te||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},t.prototype.emit=function(e){var t,r,s,a,c,l;if(this._events||(this._events={}),"error"===e&&(!this._events.error||i(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;throw TypeError('Uncaught, unspecified "error" event.')}if(r=this._events[e],o(r))return!1;if(n(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:for(s=arguments.length,a=new Array(s-1),c=1;s>c;c++)a[c-1]=arguments[c];r.apply(this,a)}else if(i(r)){for(s=arguments.length,a=new Array(s-1),c=1;s>c;c++)a[c-1]=arguments[c];for(l=r.slice(),s=l.length,c=0;s>c;c++)l[c].apply(this,a)}return!0},t.prototype.addListener=function(e,r){var s;if(!n(r))throw TypeError("listener must be a function");if(this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,n(r.listener)?r.listener:r),this._events[e]?i(this._events[e])?this._events[e].push(r):this._events[e]=[this._events[e],r]:this._events[e]=r,i(this._events[e])&&!this._events[e].warned){var s;s=o(this._maxListeners)?t.defaultMaxListeners:this._maxListeners,s&&s>0&&this._events[e].length>s&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace())}return this},t.prototype.on=t.prototype.addListener,t.prototype.once=function(e,t){function r(){this.removeListener(e,r),i||(i=!0,t.apply(this,arguments))}if(!n(t))throw TypeError("listener must be a function");var i=!1;return r.listener=t,this.on(e,r),this},t.prototype.removeListener=function(e,t){var r,o,s,a;if(!n(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(r=this._events[e],s=r.length,o=-1,r===t||n(r.listener)&&r.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(i(r)){for(a=s;a-->0;)if(r[a]===t||r[a].listener&&r[a].listener===t){o=a;break}if(0>o)return this;1===r.length?(r.length=0,delete this._events[e]):r.splice(o,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},t.prototype.removeAllListeners=function(e){var t,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(r=this._events[e],n(r))this.removeListener(e,r);else for(;r.length;)this.removeListener(e,r[r.length-1]);return delete this._events[e],this},t.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?n(this._events[e])?[this._events[e]]:this._events[e].slice():[]},t.listenerCount=function(e,t){var r;return r=e._events&&e._events[t]?n(e._events[t])?1:e._events[t].length:0}},72:/*!****************************************************!*\
32 | !*** (webpack)/~/node-libs-browser/~/util/util.js ***!
33 | \****************************************************/
34 | function(e,t,n){(function(e,r){function i(e,n){var r={seen:[],stylize:s};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),f(n)?r.showHidden=n:n&&t._extend(r,n),x(r.showHidden)&&(r.showHidden=!1),x(r.depth)&&(r.depth=2),x(r.colors)&&(r.colors=!1),x(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=o),c(r,e,r.depth)}function o(e,t){var n=i.styles[t];return n?"["+i.colors[n][0]+"m"+e+"["+i.colors[n][1]+"m":e}function s(e){return e}function a(e){var t={};return e.forEach(function(e){t[e]=!0}),t}function c(e,n,r){if(e.customInspect&&n&&T(n.inspect)&&n.inspect!==t.inspect&&(!n.constructor||n.constructor.prototype!==n)){var i=n.inspect(r,e);return w(i)||(i=c(e,i,r)),i}var o=l(e,n);if(o)return o;var s=Object.keys(n),f=a(s);if(e.showHidden&&(s=Object.getOwnPropertyNames(n)),R(n)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return u(n);if(0===s.length){if(T(n)){var v=n.name?": "+n.name:"";return e.stylize("[Function"+v+"]","special")}if(I(n))return e.stylize(RegExp.prototype.toString.call(n),"regexp");if(C(n))return e.stylize(Date.prototype.toString.call(n),"date");if(R(n))return u(n)}var y="",g=!1,b=["{","}"];if(p(n)&&(g=!0,b=["[","]"]),T(n)){var x=n.name?": "+n.name:"";y=" [Function"+x+"]"}if(I(n)&&(y=" "+RegExp.prototype.toString.call(n)),C(n)&&(y=" "+Date.prototype.toUTCString.call(n)),R(n)&&(y=" "+u(n)),0===s.length&&(!g||0==n.length))return b[0]+y+b[1];if(0>r)return I(n)?e.stylize(RegExp.prototype.toString.call(n),"regexp"):e.stylize("[Object]","special");e.seen.push(n);var E;return E=g?h(e,n,r,f,s):s.map(function(t){return d(e,n,r,f,t,g)}),e.seen.pop(),m(E,y,b)}function l(e,t){if(x(t))return e.stylize("undefined","undefined");if(w(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}return g(t)?e.stylize(""+t,"number"):f(t)?e.stylize(""+t,"boolean"):v(t)?e.stylize("null","null"):void 0}function u(e){return"["+Error.prototype.toString.call(e)+"]"}function h(e,t,n,r,i){for(var o=[],s=0,a=t.length;a>s;++s)o.push(j(t,String(s))?d(e,t,n,r,String(s),!0):"");return i.forEach(function(i){i.match(/^\d+$/)||o.push(d(e,t,n,r,i,!0))}),o}function d(e,t,n,r,i,o){var s,a,l;if(l=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]},l.get?a=l.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):l.set&&(a=e.stylize("[Setter]","special")),j(r,i)||(s="["+i+"]"),a||(e.seen.indexOf(l.value)<0?(a=v(n)?c(e,l.value,null):c(e,l.value,n-1),a.indexOf("\n")>-1&&(a=o?a.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+a.split("\n").map(function(e){return" "+e}).join("\n"))):a=e.stylize("[Circular]","special")),x(s)){if(o&&i.match(/^\d+$/))return a;s=JSON.stringify(""+i),s.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+a}function m(e,t,n){var r=0,i=e.reduce(function(e,t){return r++,t.indexOf("\n")>=0&&r++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1]:n[0]+t+" "+e.join(", ")+" "+n[1]}function p(e){return Array.isArray(e)}function f(e){return"boolean"==typeof e}function v(e){return null===e}function y(e){return null==e}function g(e){return"number"==typeof e}function w(e){return"string"==typeof e}function b(e){return"symbol"==typeof e}function x(e){return void 0===e}function I(e){return E(e)&&"[object RegExp]"===k(e)}function E(e){return"object"==typeof e&&null!==e}function C(e){return E(e)&&"[object Date]"===k(e)}function R(e){return E(e)&&("[object Error]"===k(e)||e instanceof Error)}function T(e){return"function"==typeof e}function S(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||"undefined"==typeof e}function k(e){return Object.prototype.toString.call(e)}function _(e){return 10>e?"0"+e.toString(10):e.toString(10)}function M(){var e=new Date,t=[_(e.getHours()),_(e.getMinutes()),_(e.getSeconds())].join(":");return[e.getDate(),L[e.getMonth()],t].join(" ")}function j(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var O=/%[sdj%]/g;t.format=function(e){if(!w(e)){for(var t=[],n=0;n=o)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(t){return"[Circular]"}default:return e}}),a=r[n];o>n;a=r[++n])s+=v(a)||!E(a)?" "+a:" "+i(a);return s},t.deprecate=function(n,i){function o(){if(!s){if(r.throwDeprecation)throw new Error(i);r.traceDeprecation?console.trace(i):console.error(i),s=!0}return n.apply(this,arguments)}if(x(e.process))return function(){return t.deprecate(n,i).apply(this,arguments)};if(r.noDeprecation===!0)return n;var s=!1;return o};var P,N={};t.debuglog=function(e){if(x(P)&&(P={NODE_ENV:"production"}.NODE_DEBUG||""),e=e.toUpperCase(),!N[e])if(new RegExp("\\b"+e+"\\b","i").test(P)){var n=r.pid;N[e]=function(){var r=t.format.apply(t,arguments);console.error("%s %d: %s",e,n,r)}}else N[e]=function(){};return N[e]},t.inspect=i,i.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},i.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"},t.isArray=p,t.isBoolean=f,t.isNull=v,t.isNullOrUndefined=y,t.isNumber=g,t.isString=w,t.isSymbol=b,t.isUndefined=x,t.isRegExp=I,t.isObject=E,t.isDate=C,t.isError=R,t.isFunction=T,t.isPrimitive=S,t.isBuffer=n(/*! ./support/isBuffer */167);var L=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];t.log=function(){console.log("%s - %s",M(),t.format.apply(t,arguments))},t.inherits=n(/*! inherits */169),t._extend=function(e,t){if(!t||!E(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e}}).call(t,function(){return this}(),n(/*! (webpack)/~/node-libs-browser/~/process/browser.js */168))},127:/*!*************************************!*\
35 | !*** ./~/css-loader/cssToString.js ***!
36 | \*************************************/
37 | function(e){e.exports=function(){var e=[];return e.toString=function(){for(var e=[],t=0;t0)){var r=n.shift();r()}},!0),function(e){n.push(e),window.postMessage("process-tick","*")}}return function(e){setTimeout(e,0)}}(),n.title="browser",n.browser=!0,n.env={},n.argv=[],n.on=t,n.addListener=t,n.once=t,n.off=t,n.removeListener=t,n.removeAllListeners=t,n.emit=t,n.binding=function(){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(){throw new Error("process.chdir is not supported")}},169:/*!***************************************************************************!*\
44 | !*** (webpack)/~/node-libs-browser/~/util/~/inherits/inherits_browser.js ***!
45 | \***************************************************************************/
46 | function(e){e.exports="function"==typeof Object.create?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}}});
47 | //# sourceMappingURL=6.bundle.js.map
--------------------------------------------------------------------------------
/build/7.bundle.js:
--------------------------------------------------------------------------------
1 | webpackJsonp([7],{9:/*!*************************!*\
2 | !*** ./demo7/demo7.jsx ***!
3 | \*************************/
4 | function(e,t,n){var r=n(/*! react */1),i=r.createClass({displayName:"CodeListing",propTypes:{filename:r.PropTypes.string},getDefaultProps:function(){return{filename:"unnamed file"}},render:function(){var e={backgroundColor:"black",color:"white",padding:5,fontFamily:"monospace"};return r.createElement("div",{style:{border:"1px solid black"}},r.createElement("div",{style:e},this.props.filename),r.createElement("pre",{style:{margin:5}},this.props.children))}}),o=r.createClass({displayName:"Application",render:function(){var e=["React.render(",' // We pass `"Minerva"` as the `name` property, which is'," // used in `HelloComponent`'s `render` function.",' HelloElementFactory({name: "Minerva"}),',' document.getElementById("container")',");"].join("\n");return r.createElement("div",null,r.createElement("p",null,"Here is some code:"),r.createElement(i,{filename:"simple.jsx"},e),r.createElement("p",null,"And some more:"),r.createElement(i,null,'CodeListing with no "filename" property'))}});r.render(r.createElement(o,null),document.getElementById("container"))},18:/*!****************************************!*\
5 | !*** ./~/raw-loader!./demo7/demo7.jsx ***!
6 | \****************************************/
7 | function(e){e.exports='var React = require("react");\n\n// Sometimes it\'s useful have a component that can\n// wrap other arbitrary ReactElements. React provides\n// `this.props.children` for this purpose.\n//\n// For example, given the following JSX:\n//\n// Inner text\n//\n// Inside `Component`, `this.props.children` provides:\n//\n// Inner text\n//\n// In this example, we\'ll create a component that provides\n// a code listing with preformatted text and a label for\n// the filename.\n\nvar CodeListing = React.createClass({\n propTypes: {\n filename: React.PropTypes.string\n },\n\n getDefaultProps() {\n return {\n filename: "unnamed file"\n };\n },\n\n render() {\n var filenameStyle = {\n backgroundColor: "black",\n color: "white",\n padding: 5,\n fontFamily: "monospace"\n };\n\n return (\n
\n
{this.props.filename}
\n
{this.props.children}
\n
\n );\n }\n});\n\nvar Application = React.createClass({\n render() {\n var code = [\n \'React.render(\',\n \' // We pass `"Minerva"` as the `name` property, which is\',\n \' // used in `HelloComponent`\\\'s `render` function.\',\n \' HelloElementFactory({name: "Minerva"}),\',\n \' document.getElementById("container")\',\n \');\'\n ].join("\\n");\n\n // We simply wrap whatever we want to show up in the code listing\n // in a `` element, and it\'s provided as\n // `this.props.children` in the `CodeListing` component.\n return (\n
\n
Here is some code:
\n {code}\n
And some more:
\n CodeListing with no "filename" property\n
\n );\n }\n});\n\nReact.render(\n ,\n document.getElementById("container")\n);\n'}});
8 | //# sourceMappingURL=7.bundle.js.map
--------------------------------------------------------------------------------
/build/7.bundle.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"sources":["webpack:///7.bundle.js","webpack:///./demo7/demo7.jsx","webpack:///./demo7/demo7.jsx?39ff"],"names":["webpackJsonp",9,"module","exports","__webpack_require__","React","CodeListing","createClass","displayName","propTypes","filename","PropTypes","string","getDefaultProps","render","filenameStyle","backgroundColor","color","padding","fontFamily","createElement","style","border","this","props","margin","children","Application","code","join","document","getElementById",18],"mappings":"AAAAA,cAAc,IAERC;;;AAIA,SAASC,EAAQC,EAASC,GCNhC,GAAIC,GAAQD,cAAQ,GAkBhBE,EAAAD,EAAAE,aAAiCC,YAAA,cACnCC,WACEC,SAAUL,EAAMM,UAAUC,QAG5BC,gBAAe,WACb,OACEH,SAAU,iBAIdI,OAAM,WACJ,GAAIC,IACFC,gBAAiB,QACjBC,MAAO,QACPC,QAAS,EACTC,WAAY,YAGd,OACEd,GAAAe,cAAA,OAAIC,OAAMC,OAAS,oBACjBjB,EAAAe,cAAA,OAAIC,MAACN,GAAsBQ,KAACC,MAAKd,UACjCL,EAAAe,cAAA,OAAIC,OAAMI,OAAS,IAAMF,KAACC,MAAKE,cAMnCC,EAAAtB,EAAAE,aAAiCC,YAAA,cACnCM,OAAM,WACF,GAAIc,IACF,gBACA,4DACA,qDACA,4CACA,yCACA,MACAC,KAAK,KAKT,OACExB,GAAAe,cAAA,MAAI,KACFf,EAAAe,cAAA,IAAE,KAAC,sBACHf,EAAAe,cAACd,GAAWI,SAAC,cAAsBkB,GACnCvB,EAAAe,cAAA,IAAE,KAAC,kBACHf,EAAAe,cAACd,EAAW,KAAC,8CAMrBD,GAAMS,OACJT,EAAAe,cAACO,EAAW,MACZG,SAASC,eAAe,eDcpBC;;;AAIA,SAAS9B,GE3FfA,EAAAC,QAAA","file":"7.bundle.js","sourcesContent":["webpackJsonp([7],{\n\n/***/ 9:\n/*!*************************!*\\\n !*** ./demo7/demo7.jsx ***!\n \\*************************/\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar React = __webpack_require__(/*! react */ 1);\n\t\n\t// Sometimes it's useful have a component that can\n\t// wrap other arbitrary ReactElements. React provides\n\t// `this.props.children` for this purpose.\n\t//\n\t// For example, given the following JSX:\n\t//\n\t// Inner text\n\t//\n\t// Inside `Component`, `this.props.children` provides:\n\t//\n\t// Inner text\n\t//\n\t// In this example, we'll create a component that provides\n\t// a code listing with preformatted text and a label for\n\t// the filename.\n\t\n\tvar CodeListing = React.createClass({displayName: 'CodeListing',\n\t propTypes: {\n\t filename: React.PropTypes.string\n\t },\n\t\n\t getDefaultProps:function() {\n\t return {\n\t filename: \"unnamed file\"\n\t };\n\t },\n\t\n\t render:function() {\n\t var filenameStyle = {\n\t backgroundColor: \"black\",\n\t color: \"white\",\n\t padding: 5,\n\t fontFamily: \"monospace\"\n\t };\n\t\n\t return (\n\t React.createElement(\"div\", {style: {border: \"1px solid black\"}}, \n\t React.createElement(\"div\", {style: filenameStyle}, this.props.filename), \n\t React.createElement(\"pre\", {style: {margin: 5}}, this.props.children)\n\t )\n\t );\n\t }\n\t});\n\t\n\tvar Application = React.createClass({displayName: 'Application',\n\t render:function() {\n\t var code = [\n\t 'React.render(',\n\t ' // We pass `\"Minerva\"` as the `name` property, which is',\n\t ' // used in `HelloComponent`\\'s `render` function.',\n\t ' HelloElementFactory({name: \"Minerva\"}),',\n\t ' document.getElementById(\"container\")',\n\t ');'\n\t ].join(\"\\n\");\n\t\n\t // We simply wrap whatever we want to show up in the code listing\n\t // in a `` element, and it's provided as\n\t // `this.props.children` in the `CodeListing` component.\n\t return (\n\t React.createElement(\"div\", null, \n\t React.createElement(\"p\", null, \"Here is some code:\"), \n\t React.createElement(CodeListing, {filename: \"simple.jsx\"}, code), \n\t React.createElement(\"p\", null, \"And some more:\"), \n\t React.createElement(CodeListing, null, \"CodeListing with no \\\"filename\\\" property\")\n\t )\n\t );\n\t }\n\t});\n\t\n\tReact.render(\n\t React.createElement(Application, null),\n\t document.getElementById(\"container\")\n\t);\n\n\n/***/ },\n\n/***/ 18:\n/*!****************************************!*\\\n !*** ./~/raw-loader!./demo7/demo7.jsx ***!\n \\****************************************/\n/***/ function(module, exports, __webpack_require__) {\n\n\tmodule.exports = \"var React = require(\\\"react\\\");\\n\\n// Sometimes it's useful have a component that can\\n// wrap other arbitrary ReactElements. React provides\\n// `this.props.children` for this purpose.\\n//\\n// For example, given the following JSX:\\n//\\n// Inner text\\n//\\n// Inside `Component`, `this.props.children` provides:\\n//\\n// Inner text\\n//\\n// In this example, we'll create a component that provides\\n// a code listing with preformatted text and a label for\\n// the filename.\\n\\nvar CodeListing = React.createClass({\\n propTypes: {\\n filename: React.PropTypes.string\\n },\\n\\n getDefaultProps() {\\n return {\\n filename: \\\"unnamed file\\\"\\n };\\n },\\n\\n render() {\\n var filenameStyle = {\\n backgroundColor: \\\"black\\\",\\n color: \\\"white\\\",\\n padding: 5,\\n fontFamily: \\\"monospace\\\"\\n };\\n\\n return (\\n
\\n
{this.props.filename}
\\n
{this.props.children}
\\n
\\n );\\n }\\n});\\n\\nvar Application = React.createClass({\\n render() {\\n var code = [\\n 'React.render(',\\n ' // We pass `\\\"Minerva\\\"` as the `name` property, which is',\\n ' // used in `HelloComponent`\\\\'s `render` function.',\\n ' HelloElementFactory({name: \\\"Minerva\\\"}),',\\n ' document.getElementById(\\\"container\\\")',\\n ');'\\n ].join(\\\"\\\\n\\\");\\n\\n // We simply wrap whatever we want to show up in the code listing\\n // in a `` element, and it's provided as\\n // `this.props.children` in the `CodeListing` component.\\n return (\\n
\\n
Here is some code:
\\n {code}\\n
And some more:
\\n CodeListing with no \\\"filename\\\" property\\n
\\n );\\n }\\n});\\n\\nReact.render(\\n ,\\n document.getElementById(\\\"container\\\")\\n);\\n\"\n\n/***/ }\n\n});\n\n\n/** WEBPACK FOOTER **\n ** 7.bundle.js\n **/","var React = require(\"react\");\n\n// Sometimes it's useful have a component that can\n// wrap other arbitrary ReactElements. React provides\n// `this.props.children` for this purpose.\n//\n// For example, given the following JSX:\n//\n// Inner text\n//\n// Inside `Component`, `this.props.children` provides:\n//\n// Inner text\n//\n// In this example, we'll create a component that provides\n// a code listing with preformatted text and a label for\n// the filename.\n\nvar CodeListing = React.createClass({\n propTypes: {\n filename: React.PropTypes.string\n },\n\n getDefaultProps() {\n return {\n filename: \"unnamed file\"\n };\n },\n\n render() {\n var filenameStyle = {\n backgroundColor: \"black\",\n color: \"white\",\n padding: 5,\n fontFamily: \"monospace\"\n };\n\n return (\n
\n
{this.props.filename}
\n
{this.props.children}
\n
\n );\n }\n});\n\nvar Application = React.createClass({\n render() {\n var code = [\n 'React.render(',\n ' // We pass `\"Minerva\"` as the `name` property, which is',\n ' // used in `HelloComponent`\\'s `render` function.',\n ' HelloElementFactory({name: \"Minerva\"}),',\n ' document.getElementById(\"container\")',\n ');'\n ].join(\"\\n\");\n\n // We simply wrap whatever we want to show up in the code listing\n // in a `` element, and it's provided as\n // `this.props.children` in the `CodeListing` component.\n return (\n
\n
Here is some code:
\n {code}\n
And some more:
\n CodeListing with no \"filename\" property\n
\n );\n }\n});\n\nReact.render(\n ,\n document.getElementById(\"container\")\n);\n\n\n\n/** WEBPACK FOOTER **\n ** ./demo7/demo7.jsx\n **/","module.exports = \"var React = require(\\\"react\\\");\\n\\n// Sometimes it's useful have a component that can\\n// wrap other arbitrary ReactElements. React provides\\n// `this.props.children` for this purpose.\\n//\\n// For example, given the following JSX:\\n//\\n// Inner text\\n//\\n// Inside `Component`, `this.props.children` provides:\\n//\\n// Inner text\\n//\\n// In this example, we'll create a component that provides\\n// a code listing with preformatted text and a label for\\n// the filename.\\n\\nvar CodeListing = React.createClass({\\n propTypes: {\\n filename: React.PropTypes.string\\n },\\n\\n getDefaultProps() {\\n return {\\n filename: \\\"unnamed file\\\"\\n };\\n },\\n\\n render() {\\n var filenameStyle = {\\n backgroundColor: \\\"black\\\",\\n color: \\\"white\\\",\\n padding: 5,\\n fontFamily: \\\"monospace\\\"\\n };\\n\\n return (\\n
\\n
{this.props.filename}
\\n
{this.props.children}
\\n
\\n );\\n }\\n});\\n\\nvar Application = React.createClass({\\n render() {\\n var code = [\\n 'React.render(',\\n ' // We pass `\\\"Minerva\\\"` as the `name` property, which is',\\n ' // used in `HelloComponent`\\\\'s `render` function.',\\n ' HelloElementFactory({name: \\\"Minerva\\\"}),',\\n ' document.getElementById(\\\"container\\\")',\\n ');'\\n ].join(\\\"\\\\n\\\");\\n\\n // We simply wrap whatever we want to show up in the code listing\\n // in a `` element, and it's provided as\\n // `this.props.children` in the `CodeListing` component.\\n return (\\n
\\n
Here is some code:
\\n {code}\\n
And some more:
\\n CodeListing with no \\\"filename\\\" property\\n