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