有一个好的 griddle-react 插件示例吗?
Have a good griddle-react plugin example?
插件文档指出:
When adding functionality to Griddle, you’ll likely need to response to actions and update the application state. This can easily be done by adding action handling functions to your reducer
object.
我正在编写一个插件,用 bootstrap 样式的分页替换默认的分页。这将需要在操作中访问 getNext() getPrevious() and setPage()
。我可以清楚地看到如何像 local
插件一样从 Griddle 包内部访问这些内容。
我不确定如何从我的应用程序中编写的插件访问这些功能和状态。
我需要从 Griddle 导入什么?我需要打电话给什么?
找到了。在 Story Book 中,custom page size settings story 访问 selectors
和 actions
导出,让插件更直接地访问内部结构。围绕它的其他故事很好地演示了如何从插件访问 Griddle 内部。
请注意,除了直接访问导出的 selectors
和 actions
之外,两者都可以通过 React Context 获得,例如在 LocalPlugin.components.TableBodyContainer
。上下文 应该 在应用插件后为当前 <Griddle />
公开 "best" selectors
/actions
。
在 https://github.com/GriddleGriddle/Griddle/pull/743 中开始了一些工作以使选择器更具可组合性,但 PR 已经过时了。
插件文档指出:
When adding functionality to Griddle, you’ll likely need to response to actions and update the application state. This can easily be done by adding action handling functions to your
reducer
object.
我正在编写一个插件,用 bootstrap 样式的分页替换默认的分页。这将需要在操作中访问 getNext() getPrevious() and setPage()
。我可以清楚地看到如何像 local
插件一样从 Griddle 包内部访问这些内容。
我不确定如何从我的应用程序中编写的插件访问这些功能和状态。
我需要从 Griddle 导入什么?我需要打电话给什么?
找到了。在 Story Book 中,custom page size settings story 访问 selectors
和 actions
导出,让插件更直接地访问内部结构。围绕它的其他故事很好地演示了如何从插件访问 Griddle 内部。
请注意,除了直接访问导出的 selectors
和 actions
之外,两者都可以通过 React Context 获得,例如在 LocalPlugin.components.TableBodyContainer
。上下文 应该 在应用插件后为当前 <Griddle />
公开 "best" selectors
/actions
。
在 https://github.com/GriddleGriddle/Griddle/pull/743 中开始了一些工作以使选择器更具可组合性,但 PR 已经过时了。