Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

vincent15000's avatar

How is it possible to use props inside mount() ?

Hello,

I'm trying to use a props inside mount(). The problem is this one :

  • before mount(), studentId has no value
  • while mount(), studentId has no value
  • after mount(), studentId has a the good value

If you have any idea how to solve that ;), please help me because I have this problem for a while on several components.

The only solution I have found is to set a watcher on the props I need to use in mount() and then I can use the props.

Thanks a lot.

props: {
	studentId: {}
},
...
mounted() {
	this.loadStats()
},
...
methods: {
	loadStats() {
		this.$store.dispatch('sessions/getStats', this.studentId)
	},
}
0 likes
2 replies

Please or to participate in this conversation.