Complete Expo App Development Guide
Welcome to the most comprehensive guide for building React Native applications with Expo. This tutorial will take you from zero to publishing your first app on both iOS and Android app stores.
What You'll Learn
By the end of this tutorial, you'll have:
- ā
Built a complete React Native app using Expo
- ā
Implemented navigation between screens
- ā
Managed application state effectively
- ā
Integrated with external APIs
- ā
Created a polished user interface
- ā
Deployed your app to app stores
Prerequisites
Before starting this tutorial, you should have:
- Basic knowledge of JavaScript and React
- Node.js installed on your computer
- A smartphone for testing (iOS or Android)
- Basic understanding of mobile app concepts
Chapter 1: Setting Up Your Development Environment
Installing Required Tools
First, let's set up everything you need for Expo development:
``bash
Install Node.js (if not already installed)
Download from https://nodejs.org/
Install Expo CLI globally
npm install -g @expo/cli
Verify installation
expo --version
`
Setting Up Your Mobile Device
1. Install Expo Go App
- iOS: Download from App Store
- Android: Download from Google Play Store
2. Create Expo Account
- Sign up at https://expo.dev
- This will be used for building and publishing
Development Environment Options
You have several options for development:
1. Local Development (Recommended)
- Full control over your environment
- Faster development cycle
- Works offline
2. Expo Snack (Web-based)
- No setup required
- Great for quick prototypes
- Limited functionality
Chapter 2: Creating Your First Expo App
Project Initialization
Let's create your first Expo project:
`bash
Create a new Expo project
npx create-expo-app MyFirstApp
Navigate to project directory
cd MyFirstApp
Start the development server
npx expo start
`
Project Structure Overview
Understanding the project structure is crucial:
`
MyFirstApp/
āāā App.js Main application component
āāā app.json Expo configuration
āāā package.json Dependencies and scripts
āāā assets/ Images, fonts, and other assets
ā āāā icon.png App icon
ā āāā splash.png Splash screen
āāā node_modules/ Installed packages
`
Your First Component
Let's modify the default App.js to understand the basics:
`javascript
import React from 'react';
import { StyleSheet, Text, View, StatusBar } from 'react-native';
export default function App() {
return (
Welcome to My First App!
This is built with Expo and React Native
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
padding: 20,
},
title: {
fontSize: 24,
fontWeight: 'bold',
marginBottom: 10,
textAlign: 'center',
},
subtitle: {
fontSize: 16,
color: '#666',
textAlign: 'center',
},
});
`
Chapter 3: Understanding React Native Components
Core Components
React Native provides several built-in components:
View Component
The building block for UI layout:
`javascript
import { View } from 'react-native';
{/* Other components go here */}
`
Text Component
For displaying text content:
`javascript
import { Text } from 'react-native';
Hello, World!
`
TouchableOpacity
For handling user interactions:
`javascript
import { TouchableOpacity, Text } from 'react-native';
style={styles.button}
onPress={() => alert('Button pressed!')}
>
Press Me
`
Styling in React Native
React Native uses a subset of CSS properties:
`javascript
const styles = StyleSheet.create({
container: {
flex: 1, // Takes full available space
flexDirection: 'column', // Layout direction
justifyContent: 'center', // Main axis alignment
alignItems: 'center', // Cross axis alignment
backgroundColor: '#f0f0f0', // Background color
padding: 20, // Internal spacing
},
button: {
backgroundColor: '#007AFF',
paddingHorizontal: 20,
paddingVertical: 10,
borderRadius: 8,
marginTop: 20,
},
buttonText: {
color: 'white',
fontSize: 16,
fontWeight: 'bold',
},
});
`
Chapter 4: Navigation with React Navigation
Installing React Navigation
`bash
npm install @react-navigation/native @react-navigation/stack
Install required dependencies
npx expo install react-native-screens react-native-safe-area-context
`
Setting Up Navigation
Create a basic navigation structure:
`javascript
import React from 'react';
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
import HomeScreen from './screens/HomeScreen';
import DetailsScreen from './screens/DetailsScreen';
const Stack = createStackNavigator();
export default function App() {
return (
name="Home"
component={HomeScreen}
options={{ title: 'My App' }}
/>
name="Details"
component={DetailsScreen}
options={{ title: 'Details' }}
/>
);
}
`
Creating Screen Components
`javascript
// screens/HomeScreen.js
import React from 'react';
import { View, Text, Button, StyleSheet } from 'react-native';
export default function HomeScreen({ navigation }) {
return (
Home Screen
title="Go to Details"
onPress={() => navigation.navigate('Details')}
/>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
},
title: {
fontSize: 24,
marginBottom: 20,
},
});
`
Chapter 5: State Management with Context API
Understanding State in React Native
State management is crucial for building interactive apps. We'll use React's Context API for global state management.
Creating a Context
`javascript
// context/AppContext.js
import React, { createContext, useContext, useReducer } from 'react';
const AppContext = createContext();
const initialState = {
user: null,
theme: 'light',
notifications: [],
};
function appReducer(state, action) {
switch (action.type) {
case 'SET_USER':
return { ...state, user: action.payload };
case 'TOGGLE_THEME':
return { ...state, theme: state.theme === 'light' ? 'dark' : 'light' };
case 'ADD_NOTIFICATION':
return {
...state,
notifications: [...state.notifications, action.payload]
};
default:
return state;
}
}
export function AppProvider({ children }) {
const [state, dispatch] = useReducer(appReducer, initialState);
return (
{children}
);
}
export function useAppContext() {
const context = useContext(AppContext);
if (!context) {
throw new Error('useAppContext must be used within AppProvider');
}
return context;
}
``
Best Practices and Tips
Performance Optimization
- Use FlatList for large lists
- Implement lazy loading for images
- Minimize re-renders with React.memo
- Use native driver for animations
Code Organization
- Separate components into different files
- Use consistent naming conventions
- Implement proper error handling
- Write meaningful comments
Testing Strategy
- Unit tests for utility functions
- Component tests with React Native Testing Library
- End-to-end tests with Detox
- Manual testing on real devices
Next Steps
After completing this tutorial, consider:
1. Advanced Navigation: Tab navigation, drawer navigation
2. State Management: Redux, Zustand, or MobX
3. Backend Integration: Firebase, Supabase, or custom APIs
4. Performance: Profiling and optimization techniques
5. Publishing: App store optimization and marketing
Conclusion
Congratulations! You've learned the fundamentals of Expo app development. This foundation will serve you well as you build more complex applications.
Remember to:
- Practice regularly by building small projects
- Stay updated with React Native and Expo releases
- Join the community for support and learning
- Contribute to open source projects
Ready to build your next app? Start with our [Icon Generator](/) to create perfect icons for your project!
By the end of this tutorial, you'll have:
- ā Built a complete React Native app using Expo
- ā Implemented navigation between screens
- ā Managed application state effectively
- ā Integrated with external APIs
- ā Created a polished user interface
- ā Deployed your app to app stores
Prerequisites
Before starting this tutorial, you should have:
- Basic knowledge of JavaScript and React
- Node.js installed on your computer
- A smartphone for testing (iOS or Android)
- Basic understanding of mobile app concepts
Chapter 1: Setting Up Your Development Environment
Installing Required Tools
First, let's set up everything you need for Expo development:
``bash
Install Node.js (if not already installed)
Download from https://nodejs.org/
Install Expo CLI globally
npm install -g @expo/cli
Verify installation
expo --version
`
Setting Up Your Mobile Device
1. Install Expo Go App
- iOS: Download from App Store
- Android: Download from Google Play Store
2. Create Expo Account
- Sign up at https://expo.dev
- This will be used for building and publishing
Development Environment Options
You have several options for development:
1. Local Development (Recommended)
- Full control over your environment
- Faster development cycle
- Works offline
2. Expo Snack (Web-based)
- No setup required
- Great for quick prototypes
- Limited functionality
Chapter 2: Creating Your First Expo App
Project Initialization
Let's create your first Expo project:
`bash
Create a new Expo project
npx create-expo-app MyFirstApp
Navigate to project directory
cd MyFirstApp
Start the development server
npx expo start
`
Project Structure Overview
Understanding the project structure is crucial:
`
MyFirstApp/
āāā App.js Main application component
āāā app.json Expo configuration
āāā package.json Dependencies and scripts
āāā assets/ Images, fonts, and other assets
ā āāā icon.png App icon
ā āāā splash.png Splash screen
āāā node_modules/ Installed packages
`
Your First Component
Let's modify the default App.js to understand the basics:
`javascript
import React from 'react';
import { StyleSheet, Text, View, StatusBar } from 'react-native';
export default function App() {
return (
Welcome to My First App!
This is built with Expo and React Native
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
padding: 20,
},
title: {
fontSize: 24,
fontWeight: 'bold',
marginBottom: 10,
textAlign: 'center',
},
subtitle: {
fontSize: 16,
color: '#666',
textAlign: 'center',
},
});
`
Chapter 3: Understanding React Native Components
Core Components
React Native provides several built-in components:
View Component
The building block for UI layout:
`javascript
import { View } from 'react-native';
{/* Other components go here */}
`
Text Component
For displaying text content:
`javascript
import { Text } from 'react-native';
Hello, World!
`
TouchableOpacity
For handling user interactions:
`javascript
import { TouchableOpacity, Text } from 'react-native';
style={styles.button}
onPress={() => alert('Button pressed!')}
>
Press Me
`
Styling in React Native
React Native uses a subset of CSS properties:
`javascript
const styles = StyleSheet.create({
container: {
flex: 1, // Takes full available space
flexDirection: 'column', // Layout direction
justifyContent: 'center', // Main axis alignment
alignItems: 'center', // Cross axis alignment
backgroundColor: '#f0f0f0', // Background color
padding: 20, // Internal spacing
},
button: {
backgroundColor: '#007AFF',
paddingHorizontal: 20,
paddingVertical: 10,
borderRadius: 8,
marginTop: 20,
},
buttonText: {
color: 'white',
fontSize: 16,
fontWeight: 'bold',
},
});
`
Chapter 4: Navigation with React Navigation
Installing React Navigation
`bash
npm install @react-navigation/native @react-navigation/stack
Install required dependencies
npx expo install react-native-screens react-native-safe-area-context
`
Setting Up Navigation
Create a basic navigation structure:
`javascript
import React from 'react';
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
import HomeScreen from './screens/HomeScreen';
import DetailsScreen from './screens/DetailsScreen';
const Stack = createStackNavigator();
export default function App() {
return (
name="Home"
component={HomeScreen}
options={{ title: 'My App' }}
/>
name="Details"
component={DetailsScreen}
options={{ title: 'Details' }}
/>
);
}
`
Creating Screen Components
`javascript
// screens/HomeScreen.js
import React from 'react';
import { View, Text, Button, StyleSheet } from 'react-native';
export default function HomeScreen({ navigation }) {
return (
Home Screen
title="Go to Details"
onPress={() => navigation.navigate('Details')}
/>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
},
title: {
fontSize: 24,
marginBottom: 20,
},
});
`
Chapter 5: State Management with Context API
Understanding State in React Native
State management is crucial for building interactive apps. We'll use React's Context API for global state management.
Creating a Context
`javascript
// context/AppContext.js
import React, { createContext, useContext, useReducer } from 'react';
const AppContext = createContext();
const initialState = {
user: null,
theme: 'light',
notifications: [],
};
function appReducer(state, action) {
switch (action.type) {
case 'SET_USER':
return { ...state, user: action.payload };
case 'TOGGLE_THEME':
return { ...state, theme: state.theme === 'light' ? 'dark' : 'light' };
case 'ADD_NOTIFICATION':
return {
...state,
notifications: [...state.notifications, action.payload]
};
default:
return state;
}
}
export function AppProvider({ children }) {
const [state, dispatch] = useReducer(appReducer, initialState);
return (
{children}
);
}
export function useAppContext() {
const context = useContext(AppContext);
if (!context) {
throw new Error('useAppContext must be used within AppProvider');
}
return context;
}
``
Best Practices and Tips
Performance Optimization
- Use FlatList for large lists
- Implement lazy loading for images
- Minimize re-renders with React.memo
- Use native driver for animations
Code Organization
- Separate components into different files
- Use consistent naming conventions
- Implement proper error handling
- Write meaningful comments
Testing Strategy
- Unit tests for utility functions
- Component tests with React Native Testing Library
- End-to-end tests with Detox
- Manual testing on real devices
Next Steps
After completing this tutorial, consider:
1. Advanced Navigation: Tab navigation, drawer navigation
2. State Management: Redux, Zustand, or MobX
3. Backend Integration: Firebase, Supabase, or custom APIs
4. Performance: Profiling and optimization techniques
5. Publishing: App store optimization and marketing
Conclusion
Congratulations! You've learned the fundamentals of Expo app development. This foundation will serve you well as you build more complex applications.
Remember to:
- Practice regularly by building small projects
- Stay updated with React Native and Expo releases
- Join the community for support and learning
- Contribute to open source projects
Ready to build your next app? Start with our [Icon Generator](/) to create perfect icons for your project!
Installing Required Tools
First, let's set up everything you need for Expo development:
``bash
Install Node.js (if not already installed)
Download from https://nodejs.org/
Install Expo CLI globally
npm install -g @expo/cli
Verify installation
expo --version
`
Setting Up Your Mobile Device
1. Install Expo Go App
- iOS: Download from App Store
- Android: Download from Google Play Store
2. Create Expo Account
- Sign up at https://expo.dev
- This will be used for building and publishing
Development Environment Options
You have several options for development:
1. Local Development (Recommended)
- Full control over your environment
- Faster development cycle
- Works offline
2. Expo Snack (Web-based)
- No setup required
- Great for quick prototypes
- Limited functionality
Chapter 2: Creating Your First Expo App
Project Initialization
Let's create your first Expo project:
`bash
Create a new Expo project
npx create-expo-app MyFirstApp
Navigate to project directory
cd MyFirstApp
Start the development server
npx expo start
`
Project Structure Overview
Understanding the project structure is crucial:
`
MyFirstApp/
āāā App.js Main application component
āāā app.json Expo configuration
āāā package.json Dependencies and scripts
āāā assets/ Images, fonts, and other assets
ā āāā icon.png App icon
ā āāā splash.png Splash screen
āāā node_modules/ Installed packages
`
Your First Component
Let's modify the default App.js to understand the basics:
`javascript
import React from 'react';
import { StyleSheet, Text, View, StatusBar } from 'react-native';
export default function App() {
return (
Welcome to My First App!
This is built with Expo and React Native
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
padding: 20,
},
title: {
fontSize: 24,
fontWeight: 'bold',
marginBottom: 10,
textAlign: 'center',
},
subtitle: {
fontSize: 16,
color: '#666',
textAlign: 'center',
},
});
`
Chapter 3: Understanding React Native Components
Core Components
React Native provides several built-in components:
View Component
The building block for UI layout:
`javascript
import { View } from 'react-native';
{/* Other components go here */}
`
Text Component
For displaying text content:
`javascript
import { Text } from 'react-native';
Hello, World!
`
TouchableOpacity
For handling user interactions:
`javascript
import { TouchableOpacity, Text } from 'react-native';
style={styles.button}
onPress={() => alert('Button pressed!')}
>
Press Me
`
Styling in React Native
React Native uses a subset of CSS properties:
`javascript
const styles = StyleSheet.create({
container: {
flex: 1, // Takes full available space
flexDirection: 'column', // Layout direction
justifyContent: 'center', // Main axis alignment
alignItems: 'center', // Cross axis alignment
backgroundColor: '#f0f0f0', // Background color
padding: 20, // Internal spacing
},
button: {
backgroundColor: '#007AFF',
paddingHorizontal: 20,
paddingVertical: 10,
borderRadius: 8,
marginTop: 20,
},
buttonText: {
color: 'white',
fontSize: 16,
fontWeight: 'bold',
},
});
`
Chapter 4: Navigation with React Navigation
Installing React Navigation
`bash
npm install @react-navigation/native @react-navigation/stack
Install required dependencies
npx expo install react-native-screens react-native-safe-area-context
`
Setting Up Navigation
Create a basic navigation structure:
`javascript
import React from 'react';
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
import HomeScreen from './screens/HomeScreen';
import DetailsScreen from './screens/DetailsScreen';
const Stack = createStackNavigator();
export default function App() {
return (
name="Home"
component={HomeScreen}
options={{ title: 'My App' }}
/>
name="Details"
component={DetailsScreen}
options={{ title: 'Details' }}
/>
);
}
`
Creating Screen Components
`javascript
// screens/HomeScreen.js
import React from 'react';
import { View, Text, Button, StyleSheet } from 'react-native';
export default function HomeScreen({ navigation }) {
return (
Home Screen
title="Go to Details"
onPress={() => navigation.navigate('Details')}
/>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
},
title: {
fontSize: 24,
marginBottom: 20,
},
});
`
Chapter 5: State Management with Context API
Understanding State in React Native
State management is crucial for building interactive apps. We'll use React's Context API for global state management.
Creating a Context
`javascript
// context/AppContext.js
import React, { createContext, useContext, useReducer } from 'react';
const AppContext = createContext();
const initialState = {
user: null,
theme: 'light',
notifications: [],
};
function appReducer(state, action) {
switch (action.type) {
case 'SET_USER':
return { ...state, user: action.payload };
case 'TOGGLE_THEME':
return { ...state, theme: state.theme === 'light' ? 'dark' : 'light' };
case 'ADD_NOTIFICATION':
return {
...state,
notifications: [...state.notifications, action.payload]
};
default:
return state;
}
}
export function AppProvider({ children }) {
const [state, dispatch] = useReducer(appReducer, initialState);
return (
{children}
);
}
export function useAppContext() {
const context = useContext(AppContext);
if (!context) {
throw new Error('useAppContext must be used within AppProvider');
}
return context;
}
``
Best Practices and Tips
Performance Optimization
- Use FlatList for large lists
- Implement lazy loading for images
- Minimize re-renders with React.memo
- Use native driver for animations
Code Organization
- Separate components into different files
- Use consistent naming conventions
- Implement proper error handling
- Write meaningful comments
Testing Strategy
- Unit tests for utility functions
- Component tests with React Native Testing Library
- End-to-end tests with Detox
- Manual testing on real devices
Next Steps
After completing this tutorial, consider:
1. Advanced Navigation: Tab navigation, drawer navigation
2. State Management: Redux, Zustand, or MobX
3. Backend Integration: Firebase, Supabase, or custom APIs
4. Performance: Profiling and optimization techniques
5. Publishing: App store optimization and marketing
Conclusion
Congratulations! You've learned the fundamentals of Expo app development. This foundation will serve you well as you build more complex applications.
Remember to:
- Practice regularly by building small projects
- Stay updated with React Native and Expo releases
- Join the community for support and learning
- Contribute to open source projects
Ready to build your next app? Start with our [Icon Generator](/) to create perfect icons for your project!
Install Node.js (if not already installed)
Download from https://nodejs.org/
Install Expo CLI globally
npm install -g @expo/cli
Verify installation
expo --version
Install Expo CLI globally
npm install -g @expo/cli
Verify installation
expo --version
expo --version
Setting Up Your Mobile Device
1. Install Expo Go App
- iOS: Download from App Store
- Android: Download from Google Play Store
2. Create Expo Account
- Sign up at https://expo.dev
- This will be used for building and publishing
Development Environment Options
You have several options for development:
1. Local Development (Recommended)
- Full control over your environment
- Faster development cycle
- Works offline
2. Expo Snack (Web-based)
- No setup required
- Great for quick prototypes
- Limited functionality
Chapter 2: Creating Your First Expo App
Project Initialization
Let's create your first Expo project:
You have several options for development:
1. Local Development (Recommended)
- Full control over your environment
- Faster development cycle
- Works offline
2. Expo Snack (Web-based)
- No setup required
- Great for quick prototypes
- Limited functionality
Chapter 2: Creating Your First Expo App
Project Initialization
Let's create your first Expo project:
Let's create your first Expo project:
Create a new Expo project
npx create-expo-app MyFirstApp
Navigate to project directory
cd MyFirstApp
Start the development server
npx expo start
cd MyFirstApp
Start the development server
npx expo start
Project Structure Overview
Understanding the project structure is crucial:
MyFirstApp/
āāā App.js
Main application component
āāā app.json Expo configuration
āāā package.json Dependencies and scripts
āāā assets/ Images, fonts, and other assets
ā āāā icon.png App icon
ā āāā splash.png Splash screen
āāā node_modules/ Installed packages
āāā package.json
Dependencies and scripts
āāā assets/ Images, fonts, and other assets
ā āāā icon.png App icon
ā āāā splash.png Splash screen
āāā node_modules/ Installed packages
ā āāā icon.png
App icon
ā āāā splash.png Splash screen
āāā node_modules/ Installed packages
āāā node_modules/
Installed packages
Your First Component
Let's modify the default App.js to understand the basics:
import React from 'react';
import { StyleSheet, Text, View, StatusBar } from 'react-native';
export default function App() {
return (
This is built with Expo and React Native
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
padding: 20,
},
title: {
fontSize: 24,
fontWeight: 'bold',
marginBottom: 10,
textAlign: 'center',
},
subtitle: {
fontSize: 16,
color: '#666',
textAlign: 'center',
},
});
Chapter 3: Understanding React Native Components
Core Components
React Native provides several built-in components:
View Component
The building block for UI layout:
React Native provides several built-in components:
View Component
The building block for UI layout:
import { View } from 'react-native';
{/* Other components go here */}
Text Component
For displaying text content:
import { Text } from 'react-native';
Hello, World!
TouchableOpacity
For handling user interactions:
import { TouchableOpacity, Text } from 'react-native';
onPress={() => alert('Button pressed!')}
>
Styling in React Native
React Native uses a subset of CSS properties:
const styles = StyleSheet.create({
container: {
flex: 1, // Takes full available space
flexDirection: 'column', // Layout direction
justifyContent: 'center', // Main axis alignment
alignItems: 'center', // Cross axis alignment
backgroundColor: '#f0f0f0', // Background color
padding: 20, // Internal spacing
},
button: {
backgroundColor: '#007AFF',
paddingHorizontal: 20,
paddingVertical: 10,
borderRadius: 8,
marginTop: 20,
},
buttonText: {
color: 'white',
fontSize: 16,
fontWeight: 'bold',
},
});
Chapter 4: Navigation with React Navigation
Installing React Navigation
npm install @react-navigation/native @react-navigation/stack
Install required dependencies
npx expo install react-native-screens react-native-safe-area-context
Setting Up Navigation
Create a basic navigation structure:
import React from 'react';
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
import HomeScreen from './screens/HomeScreen';
import DetailsScreen from './screens/DetailsScreen';
const Stack = createStackNavigator();
export default function App() {
return (
component={HomeScreen}
options={{ title: 'My App' }}
/>
component={DetailsScreen}
options={{ title: 'Details' }}
/>
);
}
Creating Screen Components
// screens/HomeScreen.js
import React from 'react';
import { View, Text, Button, StyleSheet } from 'react-native';
export default function HomeScreen({ navigation }) {
return (
title="Go to Details"
onPress={() => navigation.navigate('Details')}
/>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
},
title: {
fontSize: 24,
marginBottom: 20,
},
});
Chapter 5: State Management with Context API
Understanding State in React Native
State management is crucial for building interactive apps. We'll use React's Context API for global state management.
Creating a Context
State management is crucial for building interactive apps. We'll use React's Context API for global state management.
Creating a Context
// context/AppContext.js
import React, { createContext, useContext, useReducer } from 'react';
const AppContext = createContext();
const initialState = {
user: null,
theme: 'light',
notifications: [],
};
function appReducer(state, action) {
switch (action.type) {
case 'SET_USER':
return { ...state, user: action.payload };
case 'TOGGLE_THEME':
return { ...state, theme: state.theme === 'light' ? 'dark' : 'light' };
case 'ADD_NOTIFICATION':
return {
...state,
notifications: [...state.notifications, action.payload]
};
default:
return state;
}
}
export function AppProvider({ children }) {
const [state, dispatch] = useReducer(appReducer, initialState);
return (
{children}
);
}
export function useAppContext() {
const context = useContext(AppContext);
if (!context) {
throw new Error('useAppContext must be used within AppProvider');
}
return context;
}
Performance Optimization
- Use FlatList for large lists
- Implement lazy loading for images
- Minimize re-renders with React.memo
- Use native driver for animations
Code Organization
- Separate components into different files
- Use consistent naming conventions
- Implement proper error handling
- Write meaningful comments
Testing Strategy
- Unit tests for utility functions
- Component tests with React Native Testing Library
- End-to-end tests with Detox
- Manual testing on real devices
Next Steps
After completing this tutorial, consider:
1. Advanced Navigation: Tab navigation, drawer navigation
2. State Management: Redux, Zustand, or MobX
3. Backend Integration: Firebase, Supabase, or custom APIs
4. Performance: Profiling and optimization techniques
5. Publishing: App store optimization and marketing
Conclusion
Congratulations! You've learned the fundamentals of Expo app development. This foundation will serve you well as you build more complex applications.
Remember to:
- Practice regularly by building small projects
- Stay updated with React Native and Expo releases
- Join the community for support and learning
- Contribute to open source projects
Ready to build your next app? Start with our [Icon Generator](/) to create perfect icons for your project!
- Separate components into different files
- Use consistent naming conventions
- Implement proper error handling
- Write meaningful comments
Testing Strategy
- Unit tests for utility functions
- Component tests with React Native Testing Library
- End-to-end tests with Detox
- Manual testing on real devices
Next Steps
After completing this tutorial, consider:
1. Advanced Navigation: Tab navigation, drawer navigation
2. State Management: Redux, Zustand, or MobX
3. Backend Integration: Firebase, Supabase, or custom APIs
4. Performance: Profiling and optimization techniques
5. Publishing: App store optimization and marketing
Conclusion
Congratulations! You've learned the fundamentals of Expo app development. This foundation will serve you well as you build more complex applications.
Remember to:
- Practice regularly by building small projects
- Stay updated with React Native and Expo releases
- Join the community for support and learning
- Contribute to open source projects
Ready to build your next app? Start with our [Icon Generator](/) to create perfect icons for your project!
After completing this tutorial, consider:
1. Advanced Navigation: Tab navigation, drawer navigation
2. State Management: Redux, Zustand, or MobX
3. Backend Integration: Firebase, Supabase, or custom APIs
4. Performance: Profiling and optimization techniques
5. Publishing: App store optimization and marketing