Help with React Try to open the same page in any other browser or incognito tab and you will see that the values didn't persist. Why weren't your answers available in the other browser/incognito tab? ============================================================================== import React from "react"; import { Formik, Form, Field } from "formik"; import { useCookies } from "react-cookie"; const App = () => { const [cookies, setCookie] = useCookies(["name"]); const localStorageKey = "email"; return ( { setTimeout(() => { setCookie("name", values.name, { path: "/" }); localStorage.setItem(localStorageKey, values.email); alert(JSON.stringify(values, null, 2)); setSubmitting(false); }, 400); }} > {({ isSubmitting }) => ( Name Email Address Submit )} ); }; export default App;
Help with React Try to open the same page in any other browser or incognito tab and you will see that the values didn't persist. Why weren't your answers available in the other browser/incognito tab? ============================================================================== import React from "react"; import { Formik, Form, Field } from "formik"; import { useCookies } from "react-cookie"; const App = () => { const [cookies, setCookie] = useCookies(["name"]); const localStorageKey = "email"; return ( { setTimeout(() => { setCookie("name", values.name, { path: "/" }); localStorage.setItem(localStorageKey, values.email); alert(JSON.stringify(values, null, 2)); setSubmitting(false); }, 400); }} > {({ isSubmitting }) => ( Name Email Address Submit )} ); }; export default App;
Chapter5: Working With Excel Tables, Pivottables, And Pivotcharts
Section: Chapter Questions
Problem 3.14CP
Related questions
Question
Help with React
Try to open the same page in any other browser or incognito tab and you will see that the values didn't persist. Why weren't your answers available in the other browser/incognito tab?
==============================================================================
import React from "react";
import { Formik, Form, Field } from "formik";
import { useCookies } from "react-cookie";
const App = () => {
const [cookies, setCookie] = useCookies(["name"]);
const localStorageKey = "email";
return (
<Formik
initialValues={{
name: cookies.name || "",
email: localStorage.getItem(localStorageKey) || "",
}}
onSubmit={(values, { setSubmitting }) => {
setTimeout(() => {
setCookie("name", values.name, { path: "/" });
localStorage.setItem(localStorageKey, values.email);
alert(JSON.stringify(values, null, 2));
setSubmitting(false);
}, 400);
}}
>
{({ isSubmitting }) => (
<Form>
<label htmlFor="name">Name</label>
<Field type="text" name="name" />
<label htmlFor="email">Email Address</label>
<Field type="email" name="email" />
<button type="submit" disabled={isSubmitting}>
Submit
</button>
</Form>
)}
</Formik>
);
};
export default App;
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 3 steps
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:
9781337508841
Author:
Carey
Publisher:
Cengage
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:
9781337508841
Author:
Carey
Publisher:
Cengage