回答編集履歴
5
https://reactjs.org/docs/integrating-with-other-libraries.html#integrating-with-dom-manipulation-plu
answer
CHANGED
@@ -33,7 +33,7 @@
|
|
33
33
|
render(<Test />, document.getElementById('root'));
|
34
34
|
```
|
35
35
|
|
36
|
-
# 参考
|
36
|
+
# 参考1
|
37
37
|
|
38
38
|
解決済みイシューがありました。
|
39
39
|
[Test suite failed: jQuery is not defined #2337](https://github.com/facebook/create-react-app/issues/2337)
|
@@ -45,4 +45,14 @@
|
|
45
45
|
|
46
46
|
> I would add that this is pretty broken (on jQuery side) as it’s not really compatible with modern bundlers, and you might have better luck using React-specific libraries instead. But it seems to work.
|
47
47
|
|
48
|
-
Dan Abramovによると、この問題はjQuery側がモダンなバンドラーに上手く適合していないことが原因のようです。
|
48
|
+
Dan Abramovによると、この問題はjQuery側がモダンなバンドラーに上手く適合していないことが原因のようです。
|
49
|
+
|
50
|
+
# 参考2
|
51
|
+
[Integrating with DOM Manipulation Plugins
|
52
|
+
](https://reactjs.org/docs/integrating-with-other-libraries.html#integrating-with-dom-manipulation-plugins)
|
53
|
+
|
54
|
+
jQueryをreactで使う際のガイド的な内容が載ってます。
|
55
|
+
|
56
|
+
> Note that we defined both componentDidMount and componentWillUnmount lifecycle hooks. Many jQuery plugins attach event listeners to the DOM so it’s important to detach them in componentWillUnmount. If the plugin does not provide a method for cleanup, you will probably have to provide your own, remembering to remove any event listeners the plugin registered to prevent memory leaks.
|
57
|
+
|
58
|
+
注意書きがあると通り、componentWillMountでjQuery pluginがDOMに取り付けたイベントリスナーを外してあげないとメモリーリークの原因になるので注意して下さい。
|
4
a
answer
CHANGED
@@ -45,4 +45,4 @@
|
|
45
45
|
|
46
46
|
> I would add that this is pretty broken (on jQuery side) as it’s not really compatible with modern bundlers, and you might have better luck using React-specific libraries instead. But it seems to work.
|
47
47
|
|
48
|
-
Dan Abramovによると、この問題はjQuery側がモダンなバンドラーに上手く適合していないことが
|
48
|
+
Dan Abramovによると、この問題はjQuery側がモダンなバンドラーに上手く適合していないことが原因のようです。
|
3
あ
answer
CHANGED
@@ -39,7 +39,7 @@
|
|
39
39
|
[Test suite failed: jQuery is not defined #2337](https://github.com/facebook/create-react-app/issues/2337)
|
40
40
|
|
41
41
|
同ページにて、ReactチームのDan Abramovが対応策を投稿しています。
|
42
|
-
[https://github.com/facebook/create-react-app/issues/2337](https://github.com/facebook/create-react-app/issues/2337)
|
42
|
+
[https://github.com/facebook/create-react-app/issues/2337](https://github.com/facebook/create-react-app/issues/2337#issuecomment-303717356)
|
43
43
|
|
44
44
|
回答欄に掲載したコードは上のリンク先のコードを参考にしています。
|
45
45
|
|
2
あ
answer
CHANGED
@@ -43,4 +43,6 @@
|
|
43
43
|
|
44
44
|
回答欄に掲載したコードは上のリンク先のコードを参考にしています。
|
45
45
|
|
46
|
-
> I would add that this is pretty broken (on jQuery side) as it’s not really compatible with modern bundlers, and you might have better luck using React-specific libraries instead. But it seems to work.
|
46
|
+
> I would add that this is pretty broken (on jQuery side) as it’s not really compatible with modern bundlers, and you might have better luck using React-specific libraries instead. But it seems to work.
|
47
|
+
|
48
|
+
Dan Abramovによると、この問題はjQuery側がモダンなバンドラーに上手く適合していないことが起因のようです。
|
1
a
answer
CHANGED
@@ -31,4 +31,16 @@
|
|
31
31
|
}
|
32
32
|
|
33
33
|
render(<Test />, document.getElementById('root'));
|
34
|
-
```
|
34
|
+
```
|
35
|
+
|
36
|
+
# 参考
|
37
|
+
|
38
|
+
解決済みイシューがありました。
|
39
|
+
[Test suite failed: jQuery is not defined #2337](https://github.com/facebook/create-react-app/issues/2337)
|
40
|
+
|
41
|
+
同ページにて、ReactチームのDan Abramovが対応策を投稿しています。
|
42
|
+
[https://github.com/facebook/create-react-app/issues/2337](https://github.com/facebook/create-react-app/issues/2337)
|
43
|
+
|
44
|
+
回答欄に掲載したコードは上のリンク先のコードを参考にしています。
|
45
|
+
|
46
|
+
> I would add that this is pretty broken (on jQuery side) as it’s not really compatible with modern bundlers, and you might have better luck using React-specific libraries instead. But it seems to work.
|