Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Lightning-Fast Mobile App Development with Galio

You're reading from   Lightning-Fast Mobile App Development with Galio Build stylish cross-platform mobile apps with Galio and React Native

Arrow left icon
Product type Paperback
Published in Nov 2021
Publisher Packt
ISBN-13 9781801073165
Length 272 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Alin Gheorghe Alin Gheorghe
Author Profile Icon Alin Gheorghe
Alin Gheorghe
Arrow right icon
View More author details
Toc

Table of Contents (14) Chapters Close

Preface 1. Chapter 1:Introduction to React Native and Galio 2. Chapter 2: Basics of React Native FREE CHAPTER 3. Chapter 3: The Correct Mindset 4. Chapter 4: Your First Cross-Platform App 5. Chapter 5: Why Galio? 6. Chapter 6: The Basics of Mobile UI Building 7. Chapter 7: Exploring the State of Our App 8. Chapter 8: Creating Your Own Custom Components 9. Chapter 9: Debugging and Reaching out for Help 10. Chapter 10: Building an Onboarding Screen 11. Chapter 11: Let's Build – Stopwatch App 12. Chapter 12: Where To Go from Here? 13. Other Books You May Enjoy

Other hooks and why they're relevant

The main problem with state is the fact that the only way we can use it is in a class component. Class components are generally seen as a bit ugly and hard to learn for some beginners, so the React team tried creating something new that promised to solve the problems beginners and advanced users could have gotten into while using a class component with the traditional use of state. This is how hooks were born.

Hooks were introduced in React v16.8 and React Native v0.59. They basically let you use state and other React features without writing a class.

So, what exactly does that mean for us? Let's look at an example of how state is written with our new hooks feature:

Figure 7.11 – Example of using hooks

Woah! So, what do we have here? Is this really the same state feature we've been using so far? Yes, it is. If you were to copy this code into a fresh new project, you'd see that once you...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image