Reader small image

You're reading from  Learn React with TypeScript - Second Edition

Product typeBook
Published inMar 2023
Reading LevelBeginner
PublisherPackt
ISBN-139781804614204
Edition2nd Edition
Languages
Tools
Right arrow
Author (1)
Carl Rippon
Carl Rippon
author image
Carl Rippon

Carl Rippon has been in the software industry for over 20 years developing a complex lines of business applications in various sectors. He has spent the last 8 years building single-page applications using a wide range of JavaScript technologies including Angular, ReactJS, and TypeScript. Carl has also written over 100 blog posts on various technologies.
Read more about Carl Rippon

Right arrow

Using React Router Form

In Chapter 6, we started to learn about React Router’s Form component. We learned that Form is a wrapper around the HTML form element that handles the form submission. We will now cover Form in more detail and use it to provide a nice submission success message on our contact form.

Carry out the following steps:

  1. First, install React Router by executing the following command in the terminal:
    npm i react-router-dom
  2. Now, let’s create a ThankYouPage component, which will inform the user that their submission has been successful. To do this, create a file called ThankYouPage.tsx in the src folder with the following content:
    import { useParams } from 'react-router-dom';
    export function ThankYouPage() {
      const { name } = useParams<{ name: string }>();
      return (
        <div className="flex flex-col py-10 max-w-md       mx-auto">
          <div
     ...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Learn React with TypeScript - Second Edition
Published in: Mar 2023Publisher: PacktISBN-13: 9781804614204

Author (1)

author image
Carl Rippon

Carl Rippon has been in the software industry for over 20 years developing a complex lines of business applications in various sectors. He has spent the last 8 years building single-page applications using a wide range of JavaScript technologies including Angular, ReactJS, and TypeScript. Carl has also written over 100 blog posts on various technologies.
Read more about Carl Rippon