4👍
allCourses: this.courses
accesses a prop once on assignment so it’s null
, this should only be done with props that are expected to be static values.
If a prop is expected to change, it should be accessed only in a computed or watcher in component script section:
...
computed: {
allCourses() { return this.courses }
},
...
Since courses
and allCourses
values are the same, courses
prop could be accessed directly in the template.
Source:stackexchange.com