Show HN: Kea – The power of Redux with the simplicity of MobX
Looks pretty neat. My initial reactions:<p>- I don&#x27;t like the `@kea(...` because it&#x27;s another bit of JS syntax I hadn&#x27;t heard of before. Though I do like decorators in Python, I just feel like I have learned enough of JS syntax to be productive and they seem to keep adding unnecessary stuff.<p>- There is still duplication between the action names and the reducers. When using Redux I now always use these two functions:<p><pre><code>    function makeReducer(reducerObject) {
      return (state, action) =&gt; {
        if (Object.keys(reducerObject).includes(action.type)) {
          return reducerObject[action.type](state, action.value)
        }
        return state
      }
    }
    
    function makeActions(reducerObject) {
      const actions = {}
      Object.keys(reducerObject).forEach(name =&gt; {
        actions[name] = value =&gt; {
          return {type: name, value}
        }
      })
      return actions
    }
</code></pre>
So I can just declare a single object of reducers and can infer the action names and creators from that e.g.<p><pre><code>   const reducerObject = {
      increment(state, value) {
         return state + 1
      },
      decrement(state, value) {
         return state - 1
      }
   }
 
   const reducer = makeReducer(reducerObject)
   const actions = makeActions(reducerObject)</code></pre>