React.
js and React Native Setup Guide
1. Install [Link] and npm
Ensure [Link] and npm (Node Package Manager) are installed on your system.
# Check [Link] and npm version
node -v
npm -v
Download [Link] from [Link] if it's not installed.
2. Set Up a [Link] Project
# Install Create React App globally (Optional)
npm install -g create-react-app
# Create a new React project
npx create-react-app my-react-app
# Navigate to the project directory
cd my-react-app
# Start the development server
npm start
3. Basic [Link] Project Structure
- public/: Contains static files like [Link] and images.
- src/: Contains your React components, styles, and logic.
Example of a functional component ([Link]):
import React from 'react';
function App() {
return (
<div className="App">
<h1>Hello, [Link]!</h1>
</div>
);
export default App;
4. Install Additional Libraries for [Link] (Optional)
# React Router
npm install react-router-dom
# Axios for API requests
npm install axios
# Tailwind CSS for styling
npm install -D tailwindcss postcss autoprefixer
npx tailwindcss init
Update Tailwind in your CSS file and Tailwind config.
5. Set Up a React Native Project
# Install Expo CLI globally
npm install -g expo-cli
# Create a new React Native project
expo init my-react-native-app
# Navigate to the project directory
cd my-react-native-app
# Start the development server
expo start
6. Basic React Native Project Structure
- [Link]: The entry point for your app.
Example of a basic React Native component ([Link]):
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
export default function App() {
return (
<View style={[Link]}>
<Text>Hello, React Native!</Text>
</View>
);
const styles = [Link]({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
},
});
7. Install Additional Libraries for React Native (Optional)
# React Navigation
npm install @react-navigation/native
npm install react-native-screens react-native-safe-area-context react-native-gesture-handler
react-native-reanimated react-native-vector-icons
# Axios for API requests
npm install axios
# React Native Paper for UI components
npm install react-native-paper
8. Testing React and React Native Apps
- [Link]: Use tools like Jest and React Testing Library.
- React Native: Use tools like Jest and Detox.
# Install Jest
npm install --save-dev jest
9. Set Up Git for Version Control (Optional)
git init
echo "node_modules/" > .gitignore
git add .
git commit -m "Initial commit"
10. Deployment
- [Link]: Use platforms like Netlify, Vercel, or GitHub Pages.
- React Native: Build standalone apps using Expo or tools like EAS Build.