From 1d628ef20751f2be85df738fa17e5de47b9f89a2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Paul=20O=E2=80=99Shannessy?= this.refs.
Download the starter kit to get started.
diff --git a/docs/mixins.html b/docs/mixins.html new file mode 100644 index 0000000000..1a2992cf33 --- /dev/null +++ b/docs/mixins.html @@ -0,0 +1,159 @@ + + + + + +Mixins allow code to be shared between multiple React components. They are pretty similar to mixins +in Python or traits in PHP. Let's look at a simple example:
+var MyMixin = {
+ getMessage: function() {
+ return 'hello world';
+ }
+};
+
+var MyComponent = React.createClass({
+ mixins: [MyMixin],
+ render: function() {
+ return <div>{this.getMessage()}</div>;
+ }
+});
+A class can use multiple mixins, but no two mixins can define the same method. Two mixins can, however, +implement the same lifecycle method. In this case, each implementation will be invoked one after another.
+ +The only exception is the shouldComponentUpdate lifecycle method. This method may only be implemented once
+(either by a mixin or by the component).
var Mixin1 = {
+ componentDidMount: function() {
+ console.log('Mixin1.componentDidMount()');
+ }
+};
+
+var Mixin2 = {
+ componentDidMount: function() {
+ console.log('Mixin2.componentDidMount()');
+ }
+};
+
+
+var MyComponent = React.createClass({
+ mixins: [Mixin1, Mixin2],
+ render: function() {
+ return <div>hello world</div>;
+ }
+});
+When MyComponent is mounted into the page, the following text will print to the console:
Mixin1.componentDidMount()
+Mixin2.componentDidMount()
+In general, add a mixin whenever you want a component to share some utility methods, public interface, +or lifecycle behavior. Often it's appropriate to use them as you would use a superclass in another OOP language.
+ + + +The compressed, production version of React core
-The uncompressed, development version of React core with inline documentation.
-The JSX transformer used to support XML syntax in JavaScript.
diff --git a/downloads/react-0.3.1.zip b/downloads/react-0.3.1.zip new file mode 100644 index 0000000000000000000000000000000000000000..3c1d4795c892d6f2d8720138b508cf2489d06f48 GIT binary patch literal 396560 zcmZ^KQ*b5>%x-Pl-P*Rzx3+EDwr#gt+qSVawsyC+-unOkb9Ls-oLoIgCKs7xl9@mW z01klx0s{jBBJI^L3i5vu=6~45+}PBOftitwk%dV`LPT6%g3;bAUUSO4(+er1)c!yiPM158HZe{?3dA?pUz00}q;xl- btdEGMe+64Ei^*g8rt$3bo2^SMRaS+mwGTe#zs)vlvt%;
zsKrfGh D&C$2IPpHD3J0hWhDeEY4_Y!f*&EgthnEUUf}HSGI3QJtvohc6! X&jzQRyPti@kJW{H=Vyk{X&1~1
zu`9maY?$~s{K$a*3~Y%P4UHEEVXM#68aHIVsz-mG%}1LnrRL*dY1>U@&yf6Q5}c3M
z3sHei`3b&(mmV+Q&BquI
zmb_=m&t2fL6ux_%Mxz*?L-bQPFbjog!b**O&OLu0%ZdF6_=UsewXmQ)o;PPSZ
!8R%9k1K5p
z56)%C70qF#o*?aZ}N0WP&BabY3?^%vKwpiV>
zEO~6Px@TGP*kEWyM{dgTa6Pl4I~qVWm`s5dq@TKK4t-%H7U<_i?I