如何在rails上导入ruby中的第三方反应库

时间:2017-11-21 02:47:13

标签: ruby-on-rails reactjs

我想在rails项目中使用react-infinite-scroller。我遵循了这两个链接https://github.com/reactjs/react-rails/issues/510#issuecomment-207790440

http://rmosolgo.github.io/blog/2016/05/19/how-i-use-sprockets/

这是我做的: enter image description here

我使用while导入了它 在application.js中我使用它:

//= require ./vendor/InfiniteScroll-v1.0.0

但仍有错误&#34; <InfiniteScroll pageStart={0}> <ContentTable data={this.state.tableData} filterText={this.state.filterText} onUserClick={this.handleUserClick} dataType={this.props.dataType} showPublic={this.state.publicCheckbox} /> </InfiniteScroll> &#34;。我该怎么做才能让它发挥作用?

1 个答案:

答案 0 :(得分:0)

此处缺少代码。你是怎么引用它的?我看不出你是如何引用它的,所以我会采取有根据的猜测。

错误是说你没有正确引用它。

此链接应作为线索:

https://github.com/seatgeek/react-infinite

和这一个:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ReferenceError