I have a property of type Boolean - websiteHasCode which takes a value from store. I want to render html in the page conditionally using websiteHasCode ( true or false ) , Initially the component A is fine ( correct value for websiteHasCode ). There is a modal in the page , which is child component B of component A, The modal has the functinality of updating the store value - isCodeActive. So when it updates I want the variable websiteHasCode to also update and eventually the Dom, So I used a watcher and computed as in this SO question, But it doesn't seem to update. Can anyone help what i got wrong here ?
<template> 
  <div>
    <div v-if="websiteHasCode">
          ...............
    </div>
    <div v-else>
          ................
    </div>
  </div>
</template>
<script>
    export default {
        name: "dashboard",
        props: [],
        data() {
            return {
                websiteHasCode: Boolean,
            }
        },
        mounted() {
            this.websiteHasCode = this.$store.state.isCodeActive;
        },
        computed: {
          isCodeActive () {
            return this.$store.state.isCodeActive;
          }
        },
        watch: {
          isCodeActive: {
            handler() {
              console.log(this.websiteHasCode) // returns false
              this.websiteHasCode = this.$store.state.isCodeActive;
              console.log(this.websiteHasCode) // returns true but dom does not re-render
            },
            deep: true
          },
        },
      }
</script>
Also is this the best way to watch state changes , are there any better ways ?
 
    