I write about VueJS. Join 8135 other Vue devs and get exclusive tips and insights delivered straight to your inbox, every week http://michaelnthiessen.com/newsletter
Thanks for pointing this out! Fixed it in the article.
I haven't thought of using a separate file, but I think that would be very useful if you're using the same set of props a lot.
Vue prop types also allow any object with a constructor as a valid type, so you can create your own custom prop types that way. I've never experimented with that, but I'm sure there's a good use case for it.
Good to know about the alternate ways to use prop types, I hadn't considered using a constructable object, certainly that would be useful if you were passing around instances of said items rather than keeping a class/function in sync with a prop type definition.
In terms of using a separate file, indeed very useful for prop types that are used in multiple places (think Users, Avatars, Posts, etc.).
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Thanks for pointing this out! Fixed it in the article.
I haven't thought of using a separate file, but I think that would be very useful if you're using the same set of props a lot.
Vue prop types also allow any object with a constructor as a valid
type
, so you can create your own custom prop types that way. I've never experimented with that, but I'm sure there's a good use case for it.Good to know about the alternate ways to use prop types, I hadn't considered using a constructable object, certainly that would be useful if you were passing around instances of said items rather than keeping a class/function in sync with a prop type definition.
In terms of using a separate file, indeed very useful for prop types that are used in multiple places (think Users, Avatars, Posts, etc.).