DEV Community

Discussion on: How I structure my mid-size NextJS projects

Collapse
 
ivan_jrmc profile image
Ivan Jeremic

index.js is bad. Try a project without will be much cleaner.

Collapse
 
josemukorivo profile image
Joseph Mukorivo • Edited

Yes makes sense, you can use just one index file to export all components from the components directory.

Collapse
 
endrureza profile image
Endru Reza

do you have any article that support your opinion as to why using index.js is bad ?

Collapse
 
ivan_jrmc profile image
Ivan Jeremic

Index.js is not meant to be used like that, first of all the guy who created node was at first unsure to make index behave like in the browser, this is what I read somewhere, also only because React is a component framework it doesn't mean every component needs to be an index, there is no benefit at all it messes with your DX in the editor the project gets more complex and it is simple not meant to be used like that.