DEV Community

Discussion on: Stop using relative paths in your React Native imports. Use Aliases instead.

Collapse
 
enchance profile image
enchance

This article is incomplete for a dev post. What are the pros and cons of this?

Collapse
 
madebyaaron profile image
Aaron Moore

I disagree, the core benefit of using aliases is covered at the beginning.

Collapse
 
joorce profile image
Jose Ortega • Edited

Maybe the core benefit is explained but what about the main drawback.
Everything has pros and cons

Thread Thread
 
dev_astador profile image
Andres Urdaneta

I'm late to the party, but I've seen this post have had good traction. In order to answer this for people that might be reading this in the future and want an opinion on this:

You have to try it to see if you like using aliases instead of relative paths in your imports. I particularly like it, but I wouldn't do it for every project. There are two downsides with this approach for me:

  1. You have to configure it. And you need to come up with a convention for your import shortcuts. And you may change your mind along the way about an import shortcut and that'll need refactor. Is a task of -5min, but either way, it takes time.
  2. You loose autocompletion.