[英]Render and activate filters from code [React/Searchkit]
如何将现有值分配给已在react中呈现的过滤器?
That depends on which filter component you're using. 这取决于您使用的是哪个过滤器组件。 Most of SearchKit components support render props like
listComponent
and itemComponent
. 大多数
listComponent
组件都支持诸如listComponent
和itemComponent
类的渲染道具。 There, you can pass a custom React component that receives variables and callbacks from the specific SearchKit component as properties. 在那里,您可以传递一个自定义的React组件,该组件从属性中接收来自特定SearchKit组件的变量和回调。
Here a quick example of the MenuFilter
: 这里是
MenuFilter
的简单示例:
<MenuFilter
field="languages.raw"
title="Languages"
id="languages"
listComponent={({items, toggleItem}) => {
// Logic would be here ....
}}
/>
Could you give extra details of what filter component you're using and what kind of field/value it is handling? 您能否提供正在使用的过滤器组件及其处理的字段/值的其他详细信息? In that way, we can provide you helpful answers.
这样,我们可以为您提供有用的答案。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.