Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Designing React Hooks the Right Way

You're reading from   Designing React Hooks the Right Way Explore design techniques and solutions to debunk the myths about adopting states using React Hooks

Arrow left icon
Product type Paperback
Published in Jan 2022
Publisher Packt
ISBN-13 9781803235950
Length 278 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Fang Jin Fang Jin
Author Profile Icon Fang Jin
Fang Jin
Arrow right icon
View More author details
Toc

Table of Contents (12) Chapters Close

Preface 1. Chapter 1: Introducing the Function Component 2. Chapter 2: Crafting States in Functions FREE CHAPTER 3. Chapter 3: Hooking into React 4. Chapter 4: Use State to Jumpstart Components 5. Chapter 5: Use Effect to Handle Side Effects 6. Chapter 6: Use Memo to Boost Performance 7. Chapter 7: Use Context to Cover an Area 8. Chapter 8: Use Ref to Hide Stuff 9. Chapter 9: Use Custom Hooks to Reuse Logic 10. Chapter 10: Building a Website with React 11. Other Books You May Enjoy

Questions and answers

Here are some questions and answers to refresh your knowledge:

  1. What is a state?

    For a function component, a state is a value created to be persistent during the life of the component. From each update, including the mount, this value can be accessed from inside a function.

  2. What are the usages of states?

    If a task can't be done within one update, that is the time we can think of using a state to reference a memory that can be accessed in multiple updates. We normally use a state to request a new update, listen to a value change, as well as perform a task at the mount. But the states can be very versatile.

  3. What does a state do to the UI?

    To determine the screen corresponding to a component, we need to know its states as well as its props. While the props are passively defined on the component interface, the states are defined inside the component to actively refine its behavior. Apps built with states can change with time, driven by either user interactions or any other external processes.

You have been reading a chapter from
Designing React Hooks the Right Way
Published in: Jan 2022
Publisher: Packt
ISBN-13: 9781803235950
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 €18.99/month. Cancel anytime