Expo React Native JavaScript best practices for clean code, functional components, performance optimization, and Expo Router navigation.
Install
npx skills add https://github.com/mindrally/skills --skill expo-react-native-javascript-best-practicesSKILL.md
Expo React Native JavaScript Best Practices
Guidelines for building high-quality Expo React Native applications with JavaScript, focusing on clean code, modularity, and performance.
Code Style and Structure
- Clean, Readable Code: Ensure your code is easy to read and understand. Use descriptive names for variables and functions.
- Functional Components: Prefer functional components with hooks (useState, useEffect) over class components
- Component Modularity: Break components into smaller, reusable pieces with single responsibility
- Feature-Based Organization: Group related components, hooks, and styles into feature directories (e.g., user-profile, chat-screen)
Naming Conventions
- Variables and Functions: Use camelCase (e.g.,
isFetchingData,handleUserInput) - Components: Use PascalCase (e.g.,
UserProfile,ChatScreen) - Directories: Use lowercase hyphenated names (e.g.,
user-profile,chat-screen)
JavaScript Usage
- Minimize global variables to prevent unintended side effects
- Leverage ES6+ features like arrow functions, destructuring, and template literals to write concise code
- Use PropTypes for type checking if not using TypeScript
Performance Optimization
- Avoid unnecessary state updates; use local state when needed
- Apply
React.memo()to prevent unnecessary re-renders - Optimize FlatList with the following props:
removeClippedSubviewsmaxToRenderPerBatchwindowSize
- Avoid anonymous functions in
renderItemor event handlers
UI and Styling
- Use
StyleSheet.create()for consistent styling or Styled Components for dynamic styles - Ensure responsive design across screen sizes and orientations
- Use optimized image libraries like
react-native-fast-image
Best Practices
- Follow React Native's threading model for smooth UI performance
- Use Expo's EAS Build and OTA updates for deployment
- Expo Router: Use Expo Router for file-based routing in your React Native app. It provides native navigation, deep linking, and works across Android, iOS, and web
Related skills
vercel-react-native-skillsvercel-labs224KReact Native and Expo best practices for building performant mobile apps. Use when building React Native components, optimizing list performance, implementing animations, or working with native modules. Triggers on tasks involving React Native, Expo, mobile performance, or native platform APIs.firebase-crashlyticsfirebase117KComprehensive guide for Firebase Crashlytics, including provisioning and SDK usage. Use this skill when the user needs help setting up Crashlytics, adding crash reporting, or using the Crashlytics SDK in their application.xcode-project-setupfirebase117KSafely modifies Xcode projects (.pbxproj) to add Swift Packages and link files. Use this skill whenever an iOS project needs dependencies installed (e.g. Firebase, Alamofire).animate-expoemilkowalski70KBuild animations in React Native and Expo, making the decisions in the order that determines whether they feel right — should it animate, which thread it runs on, which properties, spring or timing, how the gesture hands off, how it degrades. Writes the implementation with Reanimated, Gesture Handler, Expo Router and expo-haptics. Use when animating anything in an Expo app, adding gestures, sheets, screen transitions, press feedback or haptics, or fixing motion that stutters on device. For web a