为何expo init生成的App.js使用export default function而非export default class?
expo init Creates Function Component App.js Instead of Class Component? Great question! This shift is totally intentional on Expo's part, and it boils down to a couple of key reasons:
Expo Updated Its Default Project Templates
Recent versions of the Expo CLI have replaced the old class-basedApp.jstemplate with a function component version. This isn't a bug—it's a deliberate update to align with current development standards.React's Modern Preferred Approach
React has officially recommended function components paired with Hooks as the best way to write new React code for several years now. Hooks let you handle state, side effects, and other class component features with cleaner, more reusable code. Expo is just following this industry standard to give new projects a more up-to-date, maintainable starting point.You Can Still Generate Class Component Templates
If you need to stick with the class-based structure for your projects, you can explicitly specify the classic template when runningexpo init:expo init my_App_Name --template expo-template-blank-classicAlternatively, during the interactive setup flow, keep an eye out for template options labeled "classic" or "class component" (the exact wording might vary slightly based on your Expo CLI version).
内容的提问来源于stack exchange,提问作者Matt

