Ars Dev
1.98K subscribers
70 photos
7 videos
75 links
Hi, I’m Ars! Here I share practical insights on programming and AI πŸš€

To learn more JOIN my private community https://www.skool.com/ars-dev-hub-3159/about?ref=71f574f3ce3542eb976d068c3e133e1b

Contact: @ars_kylnyk
Download Telegram
useLocalStorage β€” Persist Data Like a Pro in React Native

Ever needed to store user preferences or tokens in your React Native app?Instead of manually interacting with AsyncStorage, use this custom hook to simplify the process and write cleaner code.

βœ… Implementation using @react-native-async-storage/async-storage:


import { useState, useEffect } from "react";
import AsyncStorage from "@react-native-async-storage/async-storage";

function useAsyncStorage(key, initialValue) {
const [storedValue, setStoredValue] = useState(initialValue);
const [isLoading, setIsLoading] = useState(true);

useEffect(() => {
const loadValue = async () => {
try {
const item = await AsyncStorage.getItem(key);
setStoredValue(item != null ? JSON.parse(item) : initialValue);
} catch (error) {
console.error("Error loading from AsyncStorage", error);
} finally {
setIsLoading(false);
}
};
loadValue();
}, [key]);

const setValue = async (value) => {
try {
const valueToStore =
value instanceof Function ? value(storedValue) : value;
setStoredValue(valueToStore);
await AsyncStorage.setItem(key, JSON.stringify(valueToStore));
} catch (error) {
console.error("Error setting AsyncStorage", error);
}
};

return [storedValue, setValue, isLoading];
}

export default useAsyncStorage;




πŸ§ͺ Usage Example: Theme Toggle


import React, { useEffect } from "react";
import { View, Text, Button, StyleSheet } from "react-native";
import useAsyncStorage from "./useAsyncStorage";

const ThemeSwitcher = () => {
const [theme, setTheme] = useAsyncStorage("theme", "light");

const toggleTheme = () => {
setTheme((prev) => (prev === "light" ? "dark" : "light"));
};

return (
<View style={[
styles.container,
theme === "dark" ? styles.dark : styles.light,
]}
>
<Text style={styles.text}>Current Theme: {theme}</Text>
<Button title="Toggle Theme" onPress={toggleTheme} />
</View>
);
};

const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: "center",
alignItems: "center",
},
dark: {
backgroundColor: "#222",
},
light: {
backgroundColor: "#fff",
},
text: {
fontSize: 20,
marginBottom: 16,
},
});

export default ThemeSwitcher;


React Native Hub | #customhooks
πŸ‘4
App.js Conf 2025 has officially started! πŸ˜ŽπŸŽ‰

Here’s today’s lineup:

β†’ Intro by Marcin Skotniczny
β†’ Keynote by Charlie Cheever and Jon Samp
β†’ Deploy Everywhere with Expo Router by Evan Bacon
β†’ Expo on Orbit by Aaron Grider
β†’ Life After Legacy: The New Architecture Future by Nico Corti and Riccardo Cipolleschi
β†’ Legend List: Optimizing for Peak List Performance by Jay Meistrich
β†’ Mozart Never Had React Native: You Do by Kim Chouard
β†’ Radon IDE – Code with Glee by Krzysztof Magiera
β†’ WebGPU – High performant 3D animations in React Native by Krzysztof Piaskowy
β†’ Scaling Enterprise CI/CD: A Migration Success Story by Michael Blanchard
β†’ Taking the Party Outside the App with App Clip and Live Activity by Alex Chou
β†’ The Bigger Picture by Anisha Malde and Łukasz ChludziΕ„ski
β†’ Running Small Language Models on Your Phone: Bringing AI to Mobile with React Native and ExecuTorch by Mateusz KopciΕ„ski
β†’ Building React Native Apps with Premium Feel and Quality UX by SaΓΊl Sharma

Link to the stream: https://www.youtube.com/live/K2JTTKpptGs?si=A4_g8DHiouDmrWk6

React Native Hub
πŸ‘2
Back for day two of App.js Conf. πŸ‘¨β€πŸ’»βœ¨

Here’s what’s on the agenda today:

β†’ Large-Scale React Native Development in the Age of AI by Rafael Mendiola
β†’ Brownfield React Native at Scale: Ship Dozens of Micro-Apps Daily by Sojin Park
β†’ Embracing Native Code and Capabilities in Your Expo App by Keith Kurak
β†’ Towards a Stable JavaScript API by Alex Hunt
β†’ Le Chat and a Brief History of Streaming by Delphine Bugner
β†’ Everybody Can Cook with React Native by Enzo Manuel Mangano
β†’ TanStack Query in Expo Apps: Improving DX and UX Like No Other by Devlin Duldulao
β†’ Let's Go Live: React Native Live Streaming With Zero WebRTC Knowledge by MiΕ‚osz Filimowski
β†’ Building Secure React Native Apps by Jacob Arvidsson
β†’ The Future of Authentication in React Native by Laura Beatris
β†’ Software Composing: Expo Development for Your PM by Tomasz SuΕ‚kowski
β†’ Keyboard Management Evolution in React Native by Kiryl Ziusko
β†’ Unlocking Revenue: Monetizing Your React Native App with In-App Purchases by Perttu LΓ€hteenlahti

Link to the stream: https://www.youtube.com/live/UTaJlqhTk2g?si=HZF4wIO4DmglErd9

React Native Hub
😎
Please open Telegram to view this post
VIEW IN TELEGRAM
⚑2πŸ”₯2πŸ‘1
useDebounce β€” Stop Unnecessary API Calls ⏳

When handling search inputs or live updates, debouncing prevents excessive API requests by delaying execution until the user stops typing.

Implementation:


import { useState, useEffect } from "react";

function useDebounce(value, delay = 500) {
const [debouncedValue, setDebouncedValue] = useState(value);

useEffect(() => {
const handler = setTimeout(() => setDebouncedValue(value), delay);
return () => clearTimeout(handler);
}, [value, delay]);

return debouncedValue;
}

export default useDebounce;


Usage Example:


const [searchTerm, setSearchTerm] = useState("");
const debouncedSearch = useDebounce(searchTerm, 300);

useEffect(() => {
if (debouncedSearch) {
fetch(`https://api.example.com/search?q=${debouncedSearch}`)
.then((res) => res.json())
.then((data) => console.log(data));
}
}, [debouncedSearch]);

<TextInput
placeholder="Search..."
onChangeText={(text) => setSearchTerm(text)}
/>;


βœ… Why Use It?

- Reduces unnecessary API calls
- Improves performance in search fields
- Ensures a smooth user experience

React Native Hub | #customhooks
πŸ‘7πŸ‘Ž1
πŸš€ React Native 0.80 is out! Key updates you should know:

- Upgrades to React 19.1.0 for improved stability and bug fixes

- Introduces a new Strict TypeScript API (opt-in) with enhanced typings and reduced breaking changes

- Freezes the Legacy Architecture, paving the way for better future performanceβ€”watch for compatibility warnings

- iOS builds faster (up to ~12% improvement) with experimental prebuilt dependencies

- Android APK size drops (~1 MB) thanks to Interprocedural Optimization (IPO)

- The New App screen is now modular and visually refreshed

- Last RN version with bundled JavaScriptCore (JSC) β€” future releases will require community JSC

Read the full article here

React Native Hub
⚑5πŸ‘3πŸ‘Ž1
πŸš€ Full-Screen Image Viewer in Expo Made Easy

Andrew Chester shows how to implement a sleek, full-screen image viewer with zoom using Expo and the @likashefqet/react-native-image-zoom library.

Key Highlights:

- Install @likashefqet/react-native-image-zoom + react-native-reanimated + gesture-handler
- Wrap your image in <Zoomable> to enable pinch & double-tap zoom
- Build a reusable overlay using ImageProvider + ImageView + useImperativeHandle for a smooth full-screen experience

Perfect for apps where users need to inspect image detailsβ€”just like Instagram or Facebook.

https://medium.com/@andrew.chester/react-native-expo-full-screen-image-viewer-with-zoom-made-simple-d374081acc6d

React Native Hub
πŸ”₯6
React vs Angular vs Vue

An eternal debate. I decided to ask Ai.

According to o3-pro, here are the key takeaways:

TL;DR β€” The 2025 Landscape

– React is confidently #1 in both installations and job openings,
– Angular is experiencing a corporate revival after the v17–v18 releases,
– Vue steadily holds its β€œpleasant and fast” niche with high community loyalty.

Forecast for 2025–2027

πŸ‘©β€πŸ’» React will remain the de facto standard. The release of React 19 with optimized server streaming will reinforce its leadership.

πŸ‘©β€πŸ’» Angular will grow in the B2B niche thanks to Signals, but its strict TypeScript-first architecture means a high entry barrier.

πŸ‘©β€πŸ’» Vue will continue to be a community favorite, especially in Asia. It’ll retain around 15–17% market share, but is unlikely to surpass Angular in job demand without a strong enterprise push.

On a global scale, React is objectively β€œbetter” by the numbers,
but β€œbetter for your project” β†’ depends on your team’s needs, deadlines, regulations, and technical debt.


πŸ‘©β€πŸ’» React Native Hub
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ“„ Native vs React Native - Research Paper

πŸ‘‰ Read the article here


πŸ‘©β€πŸ’» React Native Hub
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘2
πŸš€ The Future of React Native β€” What to Expect in 2025

React Native is evolving fast β€” and 2025 is shaping up to be a game-changer.

This article highlights key trends and innovations to watch:

- Tighter integration with AI and edge computing

- Growth of Expo and server-driven UI

- Better dev tools, faster builds, and more stable releases

πŸ‘‰ The Future of React Native in 2025


πŸ‘©β€πŸ’» React Native Hub
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘3
πŸ’° How to Monetize a React Native App in 2025

Building apps is great. But turning them into income? Even better.

Here are the top monetization strategies for React Native devs:

πŸ“± In-App Purchases
Great for digital goods, subscriptions, or unlocking features.

πŸ“Š Ads (with control!)
Use platforms like AdMob or Facebook Audience Network β€” just don’t ruin the UX.

πŸ›’ Freemium Model
Offer a free version, upsell the premium with real value.

🌐 Affiliate & Dropshipping
Integrate products/services and earn per conversion. Especially powerful for niche audiences.

πŸ§‘β€πŸ’» SaaS & B2B Tools
Monetize with subscriptions, dashboards, or API-based solutions built on React Native

πŸ‘©β€πŸ’» React Native Hub
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘4
πŸš€ Reusable Toasts in React Native with NativeBase

Showing clear feedback β€” errors, success, info β€” is crucial for great UX. But repeating Toast.show() everywhere? Nope.

Save time with reusable toast helpers using NativeBase. Here’s how! πŸ”₯

πŸ’‘ What We’re Building

βœ… 3 handy toast functions:

- errorToast("Something went wrong!")
- successMessageToast("Action completed!")
- infoMessageToast("Heads up!"

πŸ§‘β€πŸ’» The Code

Error Toast Helper:

import { Box, Text, Toast } from 'native-base';
import React from 'react';

export const errorToast = (message) => {
const id = 'error-toast';
if (Toast.isActive(id)) return;

Toast.show({
id,
duration: 10000,
render: () => (
<Box bg="red.500" p="2" rounded="sm" mb={5}>
<Text fontSize="md" color="white">
{message}
</Text>
</Box>
),
});
};


Copy the same pattern for success and info:

export const successMessageToast = (message) => {
const id = 'success-toast';
if (Toast.isActive(id)) return;

Toast.show({
id,
duration: 5000,
render: () => (
<Box bg="success.500" p="2" rounded="sm" mb={5}>
<Text fontSize="md" color="white">
{message}
</Text>
</Box>
),
});
};

export const infoMessageToast = (message) => {
const id = 'info-toast';
if (Toast.isActive(id)) return;

Toast.show({
id,
duration: 5000,
render: () => (
<Box bg="info.500" p="2" rounded="sm" mb={5}>
<Text fontSize="md" color="white">
{message}
</Text>
</Box>
),
});
};


βš™οΈ How to Use

Anywhere in your app:

import { errorToast, successMessageToast } from './toastHelpers';

const handleSubmit = async () => {
try {
await api.submit();
successMessageToast("Submitted successfully!");
} catch (e) {
errorToast("Something went wrong.");
}
};


Pro Tips:

- Use unique IDs for each toast type

- Adjust duration for critical vs. casual messages

- Wrap your text in a styled Box for consistent theming

πŸ‘©β€πŸ’» React Native Hub
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘3
Inline Functions in Props

Mistake: Defining functions inline inside components, which causes unnecessary re-renders.

Wrong Code:


import { Button } from 'react-native';

const MyComponent = () => {
return (
<Button title="Press Me" onPress={() => console.log('Button Pressed')} />
);
};


Correct Practice: Define the function outside or use useCallback to memoize it.


import { Button } from 'react-native';
import { useCallback } from 'react';

const MyComponent = () => {
const handlePress = useCallback(() => {
console.log('Button Pressed');
}, []);

return <Button title="Press Me" onPress={handlePress} />;
};


πŸ‘©β€πŸ’» React Native Hub
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘3
Ignoring Platform-Specific Differences

Mistake: Hardcoding platform-specific logic instead of handling differences dynamically.

Wrong Code:

import { StyleSheet, Text } from 'react-native';

const MyComponent = () => {
return <Text style={styles.text}>Hello</Text>;
};

const styles = StyleSheet.create({
text: {
fontSize: 20,
paddingTop: 20, // Might look bad on iOS
},
});


Correct Practice: Use Platform.select or conditional logic to handle differences.

import { StyleSheet, Text, Platform } from 'react-native';

const MyComponent = () => {
return <Text style={styles.text}>Hello</Text>;
};

const styles = StyleSheet.create({
text: {
fontSize: 20,
paddingTop: Platform.select({ ios: 20, android: 10 }),
},
});


πŸ‘©β€πŸ’» React Native Hub
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘6
Hardcoding Dimensions Instead of Using Flexbox

Mistake: Using fixed dimensions for layout, making the app non-responsive.

Wrong Code:


import { View, StyleSheet } from 'react-native';

const Box = () => <View style={styles.box} />;

const styles = StyleSheet.create({
box: {
width: 100,
height: 100,
backgroundColor: 'blue',
},
});


Correct Practice: Use flex for responsive layouts.


import { View, StyleSheet } from 'react-native';

const Box = () => <View style={styles.box} />;

const styles = StyleSheet.create({
box: {
flex: 1,
backgroundColor: 'blue',
},
});


πŸ‘©β€πŸ’» React Native Hub
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘3πŸ”₯1
Hey guys!

Just wanted to share this cool article on React Design Patterns. No matter how much experience we’ve got, it’s always a good idea to refresh the basics β€” helps us write cleaner code and build better apps!

Check it out πŸ‘‡

https://dev.to/codeparrot/react-design-patterns-best-practices-for-scalable-applications-46ja

React Native Hub
πŸ‘5
⚑ Hermes

Hermes is enabled by default in new Expo projects, but ensure it’s configured:


// app.json
{
"expo": {
"jsEngine": "hermes",
"plugins": [
["expo-build-properties", {
"android": { "enableHermes": true },
"ios": { "enableHermes": true }
}]
]
}
}


Impact: 60% faster startup times and 30% memory savings

Concrete gains:

- πŸš€ App startup: 60% faster startup times
- πŸ’Ύ Memory usage: 30% memory savings
- πŸ“¦ Bundle size: Smaller with bytecode pre-compilation

Note: New Architecture is enabled by default since Expo SDK 52 (November 2024) for new projects, and mandatory by default since SDK 53 (April 2025).

React Native Hub
πŸ‘3πŸ”₯1