[Vuejs]-[Vue warn]: Error in render: "TypeError: Cannot read property 'name' of undefined"

0👍

In error object there is no such property as “name” that is why is giving u the error at the time of rendering.
Also in html section do this – > v-if=”errors.name != ””

please change the data property as –

export default{
  data() {
    return {
      form: {
        name: ''
      }, 
      errors: {name:''}
    }
  },

  methods: {
    signup(){
      axios
        .post('/api/auth/signup', this.form)
        .then(result => console.log(result.data))
        .catch(err => this.errors.name = err.response.data.errors)
    }
  }

}

Leave a comment