File tree Expand file tree Collapse file tree 1 file changed +83
-0
lines changed Expand file tree Collapse file tree 1 file changed +83
-0
lines changed Original file line number Diff line number Diff line change @@ -223,6 +223,89 @@ This is not currently documented, but you can take cues from the built-in [`HTML
223
223
224
224
React DnD requires React 0.13. Make sure you are using at least that version.
225
225
226
+ ### Why my static methods and properties won't work?
227
+
228
+ Consider example
229
+
230
+ ``` javascript
231
+ var Page = React .createClass ({
232
+ mixins: [
233
+ Router .State
234
+ ],
235
+
236
+ statics: {
237
+ willTransitionTo : function (transition , params ) {
238
+ ...
239
+ },
240
+ },
241
+
242
+ render : function () {
243
+ ...
244
+ },
245
+ });
246
+
247
+ module .exports = DragDropContext (HTML5Backend)(Page);
248
+ ```
249
+
250
+ Even though a bit surprising ` willTransitionTo ` won't get triggered in this case! React DnD doesn't proxy static methods and properties as that is a problem that gets complex quite fast. Hence if you want to use static you should apply them before ` DragDropContext ` like this:
251
+
252
+ -------------------
253
+ ``` javascript
254
+ var Page = React .createClass ({
255
+ mixins: [
256
+ Router .State
257
+ ],
258
+
259
+ render : function () {
260
+ ...
261
+ },
262
+ });
263
+
264
+ module .exports = DragDropContext (HTML5Backend)(Page);
265
+ module .exports .willTransitionTo = function (transition , params ) {
266
+ ...
267
+ };
268
+ ```
269
+ -------------------
270
+ ``` javascript
271
+ function statics (a ) {
272
+ return b => Object .assign (b, a)
273
+ }
274
+
275
+ class Page {
276
+ render () {
277
+ ...
278
+ },
279
+ })
280
+
281
+ export default statics ({
282
+ willTransitionTo (transition , params ) {
283
+ ...
284
+ }
285
+ })(DragDropContext (HTML5Backend)(Page));
286
+ ```
287
+ -------------------
288
+ ``` javascript
289
+ function statics (a ) {
290
+ return b => Object .assign (b, a)
291
+ }
292
+
293
+ @statics ({
294
+ willTransitionTo (transition , params ) {
295
+ ...
296
+ }
297
+ })
298
+ @DragDropContext (HTML5Backend)
299
+ class Page {
300
+ render () {
301
+ ...
302
+ },
303
+ });
304
+
305
+ export default Page ;
306
+ ```
307
+ -------------------
308
+
226
309
## Meta
227
310
228
311
### Is this Dungeons & Dragons?
You can’t perform that action at this time.
0 commit comments