1
我想在我的应用程序中使用reactx/redux使用redux搜索来实现搜索过滤器。我得到的第一个问题是当我尝试添加存储增强器时,如示例中所示。如何实现redux搜索
// Compose :reduxSearch with other store enhancers
const enhancer = compose(
applyMiddleware(...yourMiddleware),
reduxSearch({
// Configure redux-search by telling it which resources to index for searching
resourceIndexes: {
// In this example Books will be searchable by :title and :author
books: ['author', 'title']
},
// This selector is responsible for returning each collection of searchable resources
resourceSelector: (resourceName, state) => {
// In our example, all resources are stored in the state under a :resources Map
// For example "books" are stored under state.resources.books
return state.resources.get(resourceName)
}
})
)
我明白evarything到resourceSelector,当我试图让一个深入了解的例子来看看它是如何工作的,但我可以勉强看到它们是如何产生和最后一行返回一个错误,无法读取未定义
我的状态对象的特性“GET”看起来像这样
state: {
//books is an array of objects...each object represents a book
books:[
//a book has these properties
{name, id, author, datePublished}
]
}
任何人的帮助,谁明白终极版搜索是有帮助的
谢谢,你有一个伟大的图书馆,但很少有人了解它 – Craques
对不起@brianvaughn,如果我来过粗鲁,它已经超过2周努力实现这一点,有点令人沮丧的我,我知道图书馆是好的这就是为什么我试图理解它。 – Craques
没关系。我在这样的情况下也感到沮丧。我明白。 – brianvaughn