Skip to content

3 - losing-reactivity #2156

Open
Open
@smallma

Description

@smallma
<script setup lang="ts">
import { reactive } from "vue"

const state = reactive({
  count: 0,
})

function update(value: number) {
  state.count = value;
}
</script>

<template>
  <div>
    <p>
      <span @click="update(state.count-1)">-</span>
      {{ state.count }}
      <span @click="update(state.count+1)">+</span>
    </p>
  </div>
</template>

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions