This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// views/Step2.jsx | |
import React, { useState, useContext } from "react"; | |
import { GlobalContext } from "../context/global-context"; | |
export const Step2 = ({ navigation }) => { | |
const { previous } = navigation; | |
const [state, dispatch] = useContext(GlobalContext); | |
const [firstName, setFirstName] = useState(state.firstName || ""); | |
const [surname, setSurname] = useState(state.surname || ""); | |
const [submited, setSubmited] = useState(false); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// RegistrationFormStepper.jsx | |
import React from "react"; | |
import { useStep } from "react-hooks-helper"; | |
import { Step1 } from "./views/Step1"; | |
import { Step2 } from "./views/Step2"; | |
const steps = [{ id: "step1" }, { id: "step2" }]; | |
export const RegistrationFormStepper = () => { | |
const { step, navigation } = useStep({ initialStep: 0, steps }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// views/Step1.jsx | |
import React from "react"; | |
export const Step1 = ({ navigation }) => { | |
const { next } = navigation; | |
const submitForm = () => { | |
next(); | |
}; | |
return ( | |
<> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// views/Step2.jsx | |
import React from "react"; | |
export const Step2 = ({ navigation }) => { | |
const { previous } = navigation; | |
const submitForm = (e) => {}; | |
return ( | |
<> | |
<h3>Step 2</h3> |
OlderNewer