Ask for help with issues you might be having in your project.
When stating the issue you are having, please give as much details as possible. Below I will show a good example and a bad example of asking for help.
Good Example
I am currently using Vue to send a prop down to a component and then modify the prop inside of the component, but with my current code example below I am getting the following error:
Error message: Avoid mutating a prop directly since the value will be overwritten whenever the parent component re-renders. Instead, use a data or computed property based on the prop's value.
My code example:
template
<my-component :books="books" />
javascript
export default {
props: {
books: Array
},
methods: {
sortBooks() {
this.books = this.books.sort();
}
}
}
I have tried to a google search but I didn’t find any solutions, I even added in some console.log’s in the code to see where its going wrong, but I have had no luck, can a fresh pair of eyes have a look and help me with fixing this please?
Bad Example
I am currently using Vue to send a prop down to a component but its not working, can someone help me with this please?