'Duplicate key with params value

In a vue app, I want to use a variable defined from a param, passed through the URL, in the template section. But when I try to use it, I get an undefined error when used in the template (though it is used in the script section and shows as defined).

I thought returning the variable would let me use it in the template section, but I get a duplicate key warning.

<template> 
   <div>
      <router-link
         :to="{ path: `/${m}`}" //this shows as undefined
      >Link</router-link>
   </div>
</template>
<script>
export default {
   name: "template",
   props: ["m"],
   setup() {
      const route = useRoute();
      const m = ref(route.params.m);
     
      console.log(m.value) //this works
         
      return {
         m //This shows as a duplicate key
      };
   },
};
</script>


Solution 1:[1]

Change variable name m in setup().

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Henock