Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
expo-router
Advanced tools
The expo-router package is designed to provide a routing solution for React Native applications built with Expo. It allows developers to define and manage navigation within their apps using a file-based routing system, similar to Next.js for web applications.
File-based Routing
This feature allows developers to define routes based on the file structure of their project. The useRouter hook is used to navigate between different screens.
import { useRouter } from 'expo-router';
export default function HomeScreen() {
const router = useRouter();
return (
<View>
<Button title="Go to Profile" onPress={() => router.push('/profile')} />
</View>
);
}
Dynamic Routing
Dynamic routing allows for routes that can change based on parameters. This is useful for user profiles or any other content that is dynamically generated.
import { useRouter } from 'expo-router';
export default function UserScreen({ route }) {
const { userId } = route.params;
const router = useRouter();
return (
<View>
<Text>User ID: {userId}</Text>
<Button title="Go to Home" onPress={() => router.push('/')} />
</View>
);
}
Nested Routing
Nested routing allows for more complex navigation structures, where routes can have sub-routes. This is useful for settings pages or any other hierarchical content.
import { useRouter } from 'expo-router';
export default function SettingsScreen() {
const router = useRouter();
return (
<View>
<Button title="Go to Account Settings" onPress={() => router.push('/settings/account')} />
<Button title="Go to Privacy Settings" onPress={() => router.push('/settings/privacy')} />
</View>
);
}
React Navigation is a popular library for routing and navigation in React Native applications. It provides a wide range of navigators, including stack, tab, and drawer navigators. Compared to expo-router, React Navigation offers more flexibility and customization options but requires more setup and configuration.
React Native Navigation by Wix is another powerful navigation library for React Native. It provides a native navigation experience and is highly customizable. It is more complex to set up compared to expo-router but offers better performance and native feel.
React Router Native is a version of React Router that works with React Native. It provides a similar API to React Router for web applications, making it easy to use for developers familiar with React Router. It is less opinionated than expo-router and allows for more flexibility in defining routes.
Check out the Expo Router documentation for more information.
FAQs
Expo Router is a file-based router for React Native and web applications.
The npm package expo-router receives a total of 193,124 weekly downloads. As such, expo-router popularity was classified as popular.
We found that expo-router demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 27 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.