有没有一种简单的方法可以在 React.JS 中包含 jQuery UI 插件,例如 DataTables?
Is there an easy way to include jQuery UI plugins like DataTables in React.JS?
理想情况下,我想在 React 中创建一个 class,它将在其状态中包含一个 "table"。这个 table 将是一个 jQuery 数据 table。然后每当我修改此 class 的状态以添加或删除一行时,table 都会自动做出反应。在 React 中有一种优雅的方法可以做到这一点吗?
查看 Griddle...我想这正是您要找的。
Out of the box, Griddle has sorting, filtering, paging, infinite scrolling, sub-grids and more. Even more functionality is on the way!
我强烈推荐 React training tutorial 中的方法。它以与 Jquery UI 对话框的集成为例,但它通常适用于大多数带有 React 的第 3 方库。
基本上您需要执行以下步骤:
- 在
componentDidMount
中呈现插件,并通过 props
作为插件的选项
- 在
componentWillReceiveProps
中获取新 props
时重新渲染
- 清理 DOM、取消订阅
componentWillUnmount
中的事件等
探索提供的 link 代码片段。
理想情况下,我想在 React 中创建一个 class,它将在其状态中包含一个 "table"。这个 table 将是一个 jQuery 数据 table。然后每当我修改此 class 的状态以添加或删除一行时,table 都会自动做出反应。在 React 中有一种优雅的方法可以做到这一点吗?
查看 Griddle...我想这正是您要找的。
Out of the box, Griddle has sorting, filtering, paging, infinite scrolling, sub-grids and more. Even more functionality is on the way!
我强烈推荐 React training tutorial 中的方法。它以与 Jquery UI 对话框的集成为例,但它通常适用于大多数带有 React 的第 3 方库。
基本上您需要执行以下步骤:
- 在
componentDidMount
中呈现插件,并通过props
作为插件的选项 - 在
componentWillReceiveProps
中获取新 - 清理 DOM、取消订阅
componentWillUnmount
中的事件等
props
时重新渲染
探索提供的 link 代码片段。