我写了一个简单的计数器应用程序。我尝试添加一个 saga 中间件来记录操作。非常基本的应用程序,但我的结构很好。
当我添加中间件时出现问题:我遇到了错误:
redux-saga-core.esm.js:1442 Uncaught Error: Before running a Saga, you must mount the Saga middleware on the Store using applyMiddleware
at Function.sagaMiddleware.run (redux-saga-core.esm.js:1442)
at createAppStore (Store.tsx:66)
at eval (Store.tsx:70)
at Module../src/store/Store.tsx (bundle.js:1175)
at __webpack_require__ (bundle.js:20)
at eval (App.tsx:6)
at Module../src/components/App.tsx (bundle.js:1127)
at __webpack_require__ (bundle.js:20)
at eval (index.tsx:6)
at Module../src/index.tsx (bundle.js:1151)
I found the problem is the initialiseSagaMiddleware.run(sagaLogger);
but why? It comes just after createStore...
Run Code Online (Sandbox Code Playgroud)
这是我的商店:
/**
* This is the global store, where the magic appens. Here I …Run Code Online (Sandbox Code Playgroud) 我有一个这样的字典:
Key | Value
C1 | 1
C2 | 2
C3 | 3
Run Code Online (Sandbox Code Playgroud)
现在我需要一些linq语句或lambda表达式(或其他机制)来返回这样的新对象:
new { C1 = 1, C2 = 2, C3 = 3}.
Run Code Online (Sandbox Code Playgroud)
问题是键的值只在运行时才知道,因为我只知道运行时我的新的无限对象有多少属性及其名称.
任何人都可以建议我如何实现我的目标?