Skip to content

Instantly share code, notes, and snippets.

View surfer19's full-sized avatar

Marián Mrva surfer19

View GitHub Profile
@surfer19
surfer19 / Step2.jsx
Last active September 27, 2020 15:02
// 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);
// 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 });
// views/Step1.jsx
import React from "react";
export const Step1 = ({ navigation }) => {
const { next } = navigation;
const submitForm = () => {
next();
};
return (
<>
// views/Step2.jsx
import React from "react";
export const Step2 = ({ navigation }) => {
const { previous } = navigation;
const submitForm = (e) => {};
return (
<>
<h3>Step 2</h3>