index.ts vs subComponent1.ts





4 votes · Closed

When building large scale applications, I divide my components into folders. However I the dilemma of naming the main file inside them.

Naming them index.ts allows me to require them like this

let { subModule1 } = require('./subModule/');

Which is really aesthetically pleasing and half the length, especially when you're requiring a lot of stuff.

The downside is, you end up with having multiple index.ts files to wrangle around with. At least that's that issue I'm facing.

I was wondering how to others go about this and what's their rational for their decisions.

Start a personal dev blog on your domain for free and grow your readership.

3.4K+ developers have started their personal blogs on Hashnode in the last one month.

Write in Markdown · Publish articles on custom domain · Gain readership on day zero · Automatic GitHub backup and more

No Comments Yet