将 toJS 与重新选择库一起使用时,我在反应应用程序的选择器中遇到错误。我尝试导入toJS
和不导入它,无论如何我都会收到错误消息。
nodeCreationWindow.get(...).toJS 不是函数
import { createSelector } from 'reselect'
import { toJS } from 'immutable'
const selectNodeCreationWindow = () => (state) => state.get('nodeCreationWindow')
const selectNodes = () => createSelector(
selectNodeCreationWindow(),
(nodeCreationWindow) => {
return nodeCreationWindow.get('nodes').toJS()
}
)
const selectTags = () => createSelector(
selectNodeCreationWindow(),
(nodeCreationWindow) => nodeCreationWindow.get('tags').toJS()
)
const selectSuggestions = () => createSelector(
selectNodeCreationWindow(),
(nodeCreationWindow) => nodeCreationWindow.get('suggestions').toJS()
)
export {
selectNodes,
selectTags,
selectSuggestions
}