remove entry 13 jquery animation; react has animation
Cheng Lou committed
Oct 9, 2013 at 23:50 UTC
a970957eef76c2041274accdcdb1a31ae62e1407
2 files changed
-83
docs/cookbook/cb-13-external-libraries-integration tip.md
deleted
-40
@@ -1,40 +0,0 @@
1
----
2
-id: external-libraries-integration-tip
3
-title: Integration with external libraries
4
-layout: docs
5
-permalink: external-libraries-integration-tip.html
6
----
7
-
8
-Let's try jQuery.
9
-
10
-The general concept is simple: treat `componentDidMount` as jQuery's `ready` and tag your component with a `ref`. Then, call its `getDOMNode`. Notice that with `ref` (component scope), you don't need selectors anymore!
11
-
12
-```js
13
-/** @jsx React.DOM */
14
-
15
-var ToggleBox = React.createClass({
16
- componentDidMount: function() {
17
- $(this.refs.dialogueBox.getDOMNode()).hide().fadeIn(500);
18
- },
19
- render: function() {
20
- return (
21
- <div>
22
- <button onClick={this.handleClick}>Toggle me!</button>
23
- <div
24
- ref="dialogueBox"
25
- style={{border: '1px solid gray', width: 90, height: 90, padding: 10}}
26
- >
27
- Easy!
28
- </div>
29
- </div>
30
- );
31
- },
32
- handleClick: function() {
33
- $(this.refs.dialogueBox.getDOMNode()).stop().toggle(200);
34
- }
35
-});
36
-
37
-React.renderComponent(<ToggleBox />, mountNode);
38
-```
39
-
40
-Use libraries like jQuery for things like animation and AJAX, but preferably, don't manipulate the DOM with it. There are mostly likely better way to achieve that if you're already using React.
docs/cookbook/cb-13-external-libraries-integration.md
deleted
-43
@@ -1,43 +0,0 @@
1
----
2
-id: external-libraries-integration
3
-title: Integration with external libraries
4
-layout: docs
5
-permalink: external-libraries-integration.html
6
----
7
-
8
-### Problem
9
-You want to incorporate React with jQuery for, say, its animation effects.
10
-
11
-### Solution
12
-The general concept is simple: treat `componentDidMount` as jQuery's `ready` and tag your component with a `ref`. Then, call its `getDOMNode`. Notice that with `ref` (component scope), you don't need selectors anymore!
13
-
14
-```js
15
-/** @jsx React.DOM */
16
-
17
-var ToggleBox = React.createClass({
18
- componentDidMount: function() {
19
- $(this.refs.dialogueBox.getDOMNode()).hide().fadeIn(500);
20
- },
21
- render: function() {
22
- return (
23
- <div>
24
- <button onClick={this.handleClick}>Toggle me!</button>
25
- <div
26
- ref="dialogueBox"
27
- style={{border: '1px solid gray', width: 90, height: 90, padding: 10}}
28
- >
29
- Easy!
30
- </div>
31
- </div>
32
- );
33
- },
34
- handleClick: function() {
35
- $(this.refs.dialogueBox.getDOMNode()).stop().toggle(200);
36
- }
37
-});
38
-
39
-React.renderComponent(<ToggleBox />, mountNode);
40
-```
41
-
42
-### Discussion
43
-Use libraries like jQuery for things like animation and AJAX, but preferably, don't manipulate the DOM with it. There are mostly likely better way to achieve that if you're already using React.