Answer the question
In order to leave comments, you need to log in
Error in vue project "The default value of the props default array/object should be returned by a factory function" depends on Nodejs version?
I copied the project to another instance and the error "The default value of the props default array/object should be returned by a factory function" appeared. That is, you need to replace default: [] with default: () => [], Where does the legs of this errors?In the previous Nodejs 12.20, in the new Nodejs 12.22.9 with errors.I don’t really understand the reasons for the error - it definitely depends on the version of the node, maybe on some package?If not, then from what?The fact is that the project is open source from github where in package.json "node": ">=10.x" and in it all default properties are default: []. Considering such a free version recommendation and my assumptions, there may be other errors now and in the future when updating , then I would fix the version on 12.20 and not take a steam bath.
Answer the question
In order to leave comments, you need to log in
Since objects and arrays are passed by reference to props default: [] is incorrect. It is necessary to do the default factory through the function: () => [], so that the component is reusable in the future.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question