DEV Community

Discussion on: ReactJS: Component everything or not?

Collapse
 
stereoplegic profile image
Mike Bybee • Edited

Another thing to think about when deciding when to split into components: React.lazy/dynamic imports and code-splitting your bundles. Not only do you gain the performance benefit of only loading things when you need them, but you can for example further secure* parts of your app which require authentication by not even loading them for unauthorized users (an "auth gate").

*This is not bulletproof, but rather complimentary. Real security happens on the backend, even if you're using serverless functions, DBaaS, etc. for that.