title: Mutating composite zustand object state
body: <p>I'd like to break down my zustand state into smaller reusable objects; but, the documented zustand patterns all seem to involve promoting operations up to the top-level store object.  Is there a way to allow mutations on the inner objects, without necessarily repeating every operation for every object?</p>
  <p>By way of example, let's say we have a vehicle object:</p>
  <pre class="lang-js prettyprint-override"><code>function makeVehicle() {
    return { going: false };
  }
  function startVehicle(vehicle) {
    return { ...vehicle, going: true };
  }
  function stopVehicle(vehicle) {
    return { ...vehicle, going: false };
  }
  </code></pre>
  <p>I can have a state that contains two named vehicles</p>
  <pre class="lang-js prettyprint-override"><code>import { create } from 'zustand';
  export default create(set =&gt; {
    blueVehicle: makeVehicle(),
    greenVehicle: makeVehicle()
  });
  </code></pre>
  <p>But, it seems like if I want to also export the mutators, I need to repeat each operation, for each object, with a fair bit of boilerplate:</p>
  <pre class="lang-js prettyprint-override"><code>import { create } from 'zustand';
  export default create(set =&gt; {
    blueVehicle: makeVehicle(),
    startBlueVehicle: () =&gt; set(
      state =&gt; ({ blueVehicle: startVehicle(state.blueVehicle) })
    ),
    stopBlueVehicle: () =&gt; set(
      state =&gt; ({ blueVehicle: stopVehicle(state.blueVehicle) })
    ),
    greenVehicle: makeVehicle(),
    startGreenVehicle: () =&gt; set(
      state =&gt; ({ greenVehicle: startVehicle(state.greenVehicle) })
    ),
    stopGreenVehicle: () =&gt; set(
      state =&gt; ({ greenVehicle: stopVehicle(state.greenVehicle) })
    )
  });
  </code></pre>
  <p>Is there a simpler way to express this?</p>