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
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
React Key Concepts

You're reading from   React Key Concepts An in-depth guide to React's core features

Arrow left icon
Product type Paperback
Published in Jan 2025
Publisher Packt
ISBN-13 9781836202271
Length 544 pages
Edition 2nd Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Maximilian Schwarzmüller Maximilian Schwarzmüller
Author Profile Icon Maximilian Schwarzmüller
Maximilian Schwarzmüller
Arrow right icon
View More author details
Toc

Table of Contents (21) Chapters Close

Preface 1. React – What and Why 2. Understanding React Components and JSX FREE CHAPTER 3. Components and Props 4. Working with Events and State 5. Rendering Lists and Conditional Content 6. Styling React Apps 7. Portals and Refs 8. Handling Side Effects 9. Handling User Input & Forms with Form Actions 10. Behind the Scenes of React and Optimization Opportunities 11. Working with Complex State 12. Building Custom React Hooks 13. Multipage Apps with React Router 14. Managing Data with React Router 15. Server-side Rendering & Building Fullstack Apps with Next.js 16. React Server Components & Server Actions 17. Understanding React Suspense & The use() Hook 18. Next Steps and Further Resources 19. Other Books You May Enjoy 20. Index

Summary and Key Takeaways

  • React is a library, though it’s actually a combination of two main packages: react and react-dom.
  • Though it is possible to build non-trivial UIs without React, simply using vanilla JavaScript to do so can be cumbersome, error prone, and hard to maintain.
  • React simplifies the creation of complex UIs by providing a declarative way to define the desired end states of the UI.
  • Declarative means that you define the target UI content and structure, combined with different states (e.g., “Is a modal open or closed?”), and you leave it up to React to figure out the appropriate DOM instructions.
  • The react package itself derives UI states and manages a virtual DOM. It is a “bridge,” like react-dom or react-native, that translates this virtual DOM into actual UI (DOM) instructions.
  • With React, you can build SPAs, meaning that React is used to control the entire UI on all pages as well as the routing between pages.
  • You can also use React, in combination with frameworks like Next.js, to build full-stack web applications where server- and client-side code are connected.
  • React projects can be created with the help of the Vite package, which provides a readily configured project folder and a live preview development server.

What’s Next?

At this point, you should have a basic understanding of what React is and why you might consider using it, especially for building non-trivial UIs. You learned how to create new React projects with Vite, and you are now ready to dive deeper into React and the actual key features it offers.

In the next chapter, you will learn about a concept called components, which are the fundamental building blocks of React apps. You will learn how components are used to compose UIs and why those components are needed in the first place. The next chapter will also dive deeper into JSX and explore how it is transformed into regular JavaScript code and which kind of code you could write alternatively to JSX.

Test Your Knowledge!

Test your knowledge about the concepts covered in this chapter by answering the following questions. You can then compare your answers to example answers that can be found here: https://github.com/mschwarzmueller/book-react-key-concepts-e2/blob/01-what-is-react/exercises/questions-answers.md.

  1. What is React?
  2. Which advantage does React offer over vanilla JavaScript projects?
  3. What’s the difference between imperative and declarative code?
  4. What is a Single-Page-Application (SPA)?
  5. How can you create new React projects and why do you need such a complex project setup?
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 €18.99/month. Cancel anytime