简体   繁体   中英

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 . There, you can pass a custom React component that receives variables and callbacks from the specific SearchKit component as properties.

Here a quick example of the 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM