DEV Community

mutalibb
mutalibb

Posted on

Tips I Learned While Working on React Native

I’ve worked on a couple of apps using React Native and Firebase, and along the way, I’ve learned a lot. I decided to share some of the little things I picked up that might help you too.

1. Find What Works for You

When I started, I tried splitting everything into small chunks and files (since that’s one of React’s strengths). But for me, fixing mistakes and constantly switching between files was stressful. Now, I prefer to keep my style and logic in the same file, except for functions I’ll reuse multiple times, which I move to a components folder. This way, if there’s a bug, I know exactly which file to open and can fix it faster.

This is just my personal workflow. For larger projects, splitting code into smaller files is still better for long-term maintainability.

2. Remember React Native is Still React

React Native runs on React under the hood. That means all your React knowledge still applies, especially hooks like useState, useCallback, and useEffect. Using them properly can help with performance optimization just like in React for the web.

3. Stay Up to Date and Read Documentation

This one saved me multiple times. For example, I once tried building a custom switch input from scratch and it was stressful. Later, while reading the Expo SDK docs, I discovered newer versions of React Native (and the Expo SDK) already provided this and many other built-in components like CheckBox, Switch, and Network APIs. If I hadn’t checked the docs, I’d have wasted more time reinventing the wheel.

The same goes for Firebase integration. The Expo SDK had updated guides that simplified setup. Staying updated with documentation makes life much easier.

4. Choose Well-Maintained Packages

If you’re installing packages from npm and there are multiple options, always go for the one that is actively maintained and updated. This will save you from broken code when upgrading your project later.

5. Understand Hooks and Why They Exist

Hooks aren’t just there for fun. They solve real problems. For example, when working on Clan Circle, I noticed my Firebase bill was getting too high. After debugging, I realized multiple useEffect calls were running every time the app started, fetching data from screens users never even visited.

My fix: I used useCallback wrapped inside useFocusEffect. Now, data only loads when the user opens a screen and stops listening when they leave. I also replaced some onValue listeners with get() (fetch once) where real-time updates weren’t needed. This saved me about 70% of my Firebase costs.

6. Read Documentation (Again)

Honestly, more than once I spent hours Googling or asking AI for help, only to later realize the answer was right in the official docs. Many times, 10–15 minutes of reading the docs fixed my bug instantly.

7. Use TypeScript

While Metro bundler gives good error messages, TypeScript catches issues much earlier. It helps prevent silly mistakes and speeds up development overall.

8. Learn the Native Languages (Bonus)

Knowing the official languages like Kotlin for Android and Swift for iOS can be really helpful. Sometimes, new functionalities are available in native SDKs long before they arrive in React Native or Expo. With some knowledge of Kotlin or Swift, you can implement native modules when needed.

👉 That’s it! These are some of the lessons I’ve learned while working with React Native. I hope they help you avoid some of the mistakes I made.

Top comments (0)