0
我有一个ReactJS成分,我想安装到#test-scores
上user/show.html
compontent。 组件住在app/assets/javascripts/react-components/test-score.js.jsx
。只有载荷时某些页面上有反应护栏
我怎样才能确保它只是加载当用户访问user/show
? 它加载的每一页,因为它是现在。
应用程序/资产/ Javascript角/反应-components.js:
//= require_tree ./react-components
应用程序/资产/ Javascript角/反应组分/测试score.js.jsx
1 $(document).ready(function() {
2
3 var TestResultBox = React.createClass({
4 loadTestScoreFromServer: function() {
5 $.ajax({
[snipp...]
74 React.render(
75 <TestResultBox />,
76 document.getElementById('test-scores')
77 );
这导致一个JS错误,打破其他东西:
react.js?body=1:20238 Uncaught Error: Invariant Violation:
_registerComponent(...): Target container is not a DOM element.
到我如何组织的事情有什么建议? :-)
干杯, 马丁
谢谢,就是这样! :-) – martins 2015-03-25 13:51:15