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 now! 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
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
ASP.NET Core 5 and React

You're reading from   ASP.NET Core 5 and React Full-stack web development using .NET 5, React 17, and TypeScript 4

Arrow left icon
Product type Paperback
Published in Jan 2021
Publisher Packt
ISBN-13 9781800206168
Length 568 pages
Edition 2nd Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Carl Rippon Carl Rippon
Author Profile Icon Carl Rippon
Carl Rippon
Arrow right icon
View More author details
Toc

Table of Contents (21) Chapters Close

Preface 1. Section 1: Getting Started
2. Chapter 1: Understanding the ASP.NET 5 React Template FREE CHAPTER 3. Chapter 2: Creating Decoupled React and ASP.NET 5 Apps 4. Section 2: Building a Frontend with React and TypeScript
5. Chapter 3: Getting Started with React and TypeScript 6. Chapter 4: Styling React Components with Emotion 7. Chapter 5: Routing with React Router 8. Chapter 6: Working with Forms 9. Chapter 7: Managing State with Redux 10. Section 3: Building an ASP.NET Backend
11. Chapter 8: Interacting with the Database with Dapper 12. Chapter 9: Creating REST API Endpoints 13. Chapter 10: Improving Performance and Scalability 14. Chapter 11: Securing the Backend 15. Chapter 12: Interacting with RESTful APIs 16. Section 4: Moving into Production
17. Chapter 13: Adding Automated Tests 18. Chapter 14: Configuring and Deploying to Azure 19. Chapter 15: Implementing CI and CD with Azure DevOps 20. Other Books You May Enjoy

Implementing links

In this section, we are going to use the Link component from React Router to declaratively perform navigation when clicking the app name in the app header. Then, we'll move on to programmatically performing navigation when clicking the Ask a question button to go to the ask page.

Using the Link component

At the moment, when we click on Q and A in the top-left corner of the app, it is doing an HTTP request that returns the whole React app, which, in turn, renders the home page. We are going to change this by making use of React Router's Link component so that navigation happens in the browser without an HTTP request. We are also going to make use of the Link component for the link to the sign-in page as well. We'll learn how to achieve this by performing the following steps:

  1. In Header.tsx, import the Link component from React Router. Place the following line under the existing import statements:
    import { Link } from 'react-router-dom...
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