title: How to create a computed based on another computed from composable
body: <p>I'm learning composition API doing a simple todo app but then with multiple swim-lanes (todo, doing, done).</p>
  <p>in <code>useTasks.js</code> composable I create &quot;global&quot; <code>sourceTasks</code> reactive, that later gets filled with data pulled from an API. Then it is reduced in <code>tasks</code> computed property, like this:</p>
  <pre class="lang-js prettyprint-override"><code>// useTasks.js
  
  const sourceTasks = reactive({
      list: []
  });
  
  export default function useTasks() {
      const tasks = computed(() =&gt; {
          return sourceTasks.list.reduce(divideIntoSwimLanes, [])
      });
  
      ...
  
      return {
          tasks,
          loadTasks,
          createTask
      }
  }
  </code></pre>
  <p>Nothing too complicated.</p>
  <p>Then I've got this <code>SwimLane</code> component, that well... uses the tasks :)</p>
  <pre class="lang-js prettyprint-override"><code>// SwimLane.vue - setup
  
  async setup(props) {
      const { status } = toRefs(props);
  
      const { tasks, createTask } = useTasks();
  
      return {
        tasks,
        label,
        createTask
      }
  }
  </code></pre>
  <pre class="lang-vue prettyprint-override"><code>// SwimLane.vue - template
  &lt;single-task class=&quot;m-3&quot; v-for=&quot;task in tasks[status]&quot; :title=&quot;task.title&quot; :id=&quot;task.id&quot;/&gt;
  </code></pre>
  <p>This works, but I don't find it elegant. I would prefer to create a new computed inside of SwimLane's setup, that holds the value of tasks for the given SwimLane. Putting it in the template obscures the logic.</p>
  <p>I would expect this to work, but it does not, I think it loses the reactivity but I cant wrap my head around why:</p>
  <pre class="lang-js prettyprint-override"><code>// SwimLane.vue - alternative setup
  const currentContextTasks = computed(() =&gt; {
      return tasks.value[status]
  });
  
  return {
      currentContextTasks
  }
  </code></pre>
  <p>The problem feels a bit ridiculous, but my main concern is that I have misunderstood some core concept, hence this lengthy post.</p>