Search code examples
reactjsreact-routerdirectoryfile-structure

Does folder nesting slow down React router?


I've read numerous articles about 'correct' React.js file-structuring but the way that I've found most convenient for myself is to contain each component and complementary assets in a single folder and nesting folders in a manner analogous to the DOM tree. As such, I seem to have an inordinately large degree of nesting when I build React apps.

My question is: Are there any negative side effects to nesting folders 'too much'? Can it slow down load times or hinder react router in any way, as opposed to just having 1 or 2 levels of folder nesting?


Solution

  • Nope, there won't be a performance impact based on your folder structure. Ultimately, bundlers (like Webpack) end up combining your javascript files, so your folder structure isn't actually present in the browser.