Home > Software engineering >  Vue.js maximum call stack size exceeded
Vue.js maximum call stack size exceeded

Time:03-29

I'm following along this tutorial and for some reason I am getting a "maximum call stack error"

<template>
  <SearchInput></SearchInput>
</template>

<script>

import SearchInput from './components/SearchInput.vue'
export default {
  name: 'App',
  components:{
    SearchInput
  }

};
</script>

<style>

</style>

SearchInput component view:

<template>
<SearchInput> 
    <input type="text">
</SearchInput>
</template>


<script>
export default {
    name: "SearchInput",
}
</script>


<style>

</style>

I tried giving the SearchInput its own name "SearchInputView": SearchInput but it didn't work. I'm using es6 syntax and this is a Vue 2 project. What am I doing wrong?

CodePudding user response:

Remove <SearchInput> tag from the component itself

Your SearchInput component's template should look like this.

SearchInput.vue

<template> 
    <input type="text">
</template>

You had the component itself being mounted inside itself, which resulted in a "maximum call stack error"

  • Related