Add simple docs on statics to reference section
Fixes #1056.
Ben Alpert committed
Feb 13, 2014 at 22:13 UTC
31bc18d39e1c194fcd451e48964c9813b9993d27
1 file changed
+25
docs/docs/ref-03-component-specs.md
+25
@@ -67,6 +67,31 @@ The `mixins` array allows you to use mixins to share behavior among multiple com
67
<!-- TODO: Document mixins here directly. -->
68
69
70
+### statics
71
+
72
+```javascript
73
+object statics
74
+```
75
+
76
+The `statics` object allows you to define static methods that can be called on the component class. For example:
77
+
78
+```javascript
79
+var MyComponent = React.createClass({
80
+ statics: {
81
+ customMethod: function(foo) {
82
+ return foo === 'bar';
83
+ }
84
+ },
85
+ render: function() {
86
+ }
87
+});
88
+
89
+MyComponent.customMethod('bar'); // true
90
+```
91
+
92
+Methods defined within this block are _static_, meaning that you can run them before any component instances are created, and the methods do not have access to the props or state of your components. If you want to check the value of props in a static method, have the caller pass in the props as an argument to the static method.
93
+
94
+
95
### displayName
96
97
```javascript