Skip to content

Instantly share code, notes, and snippets.

View trisha's full-sized avatar
💭
I love NYC!

Trisha Pan trisha

💭
I love NYC!
View GitHub Profile
@trisha
trisha / A-Signup.js
Last active March 15, 2021 22:18
React-Router-DOM: How to pass in props within a Redirect
// Link to article: https://patricia-pan.medium.com/react-router-dom-how-to-pass-in-props-within-a-redirect-d414a46bcd60
// The below code is for a React component (Signup.js) where a user fills out a form to create an account.
// Afterward, the page redirects to the Login page (Login.js) where the email address is already populated.
import React, { useState } from 'react' // Using function-based React.
import { Redirect } from 'react-router-dom'
const Signup = (props) => {
// Our state variables.