Explorar o código

Mini fix in rootState example. (#629)

* Mini fix in rootState example.

Maybe I misunderstood the example, but without parenthesis the `%` operator will be executed before the `+`.

* Update modules.md
Agustin Arias %!s(int64=8) %!d(string=hai) anos
pai
achega
bb083ce432
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      docs/en/modules.md

+ 1 - 1
docs/en/modules.md

@@ -58,7 +58,7 @@ const moduleA = {
   // ...
   actions: {
     incrementIfOddOnRootSum ({ state, commit, rootState }) {
-      if (state.count + rootState.count % 2 === 1) {
+      if ((state.count + rootState.count) % 2 === 1) {
         commit('increment')
       }
     }