vlbn Posted June 21, 2020 Share Posted June 21, 2020 (edited) i am wondering if there are PROS and CONS about using either #id or .classNames. this came to my mind thinking about my previous post where i had to use REFS to animate a couple elements with a timeline inside a component. but since i moved the code to a mixin i found out i could remove them and just use the #id or .className of the items and the timeline worked perfectly. so.. just out of curiosity i was wondering... are there any recomendations about this? should i use only #id tags and let the .classNames for what they are intended? thanks for reading me! Edited June 22, 2020 by dnvdk forgot to add link to previous post Link to comment Share on other sites More sharing options...
ZachSaucier Posted June 22, 2020 Share Posted June 22, 2020 Hey dnvdk. I don't understand your question. Are you asking when you should use a selector string vs a Vue reference? When using a framework like Vue we recommend always using references so that you know that your elements won't be switched out from under you as easily. 1 Link to comment Share on other sites More sharing options...
OSUblake Posted June 22, 2020 Share Posted June 22, 2020 Good article on why you should use refs, The Reusability Problem. It uses React, but the same issue will happen in other component libraries like Vue. https://www.javascriptstuff.com/use-refs-not-ids/ 3 Link to comment Share on other sites More sharing options...
vlbn Posted June 22, 2020 Author Share Posted June 22, 2020 21 minutes ago, OSUblake said: Good article on why you should use refs, The Reusability Problem. It uses React, but the same issue will happen in other component libraries like Vue. https://www.javascriptstuff.com/use-refs-not-ids/ thank you very much Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now