Last active
May 9, 2020 05:55
-
-
Save mikekoro/483664764fd0d7806ade27a6379e61c6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// LoginPage.js | |
import React from 'react'; | |
import { LoginForm } from 'LoginForm'; | |
import { useValue } from 'useValue'; | |
export default function LoginPage() { | |
const { value, assignValue } = useValue(false); // Calling our custom hook; false is the initial value this time around | |
function handleSubmit() { | |
assignValue(true); | |
} | |
return ( | |
<div> | |
<h3>Login Form</h3> | |
{ | |
value ? | |
<div data-testid="submitted-state">Submitted</div> : | |
<div data-testid="submitted-state">Not Submitted</div> | |
} | |
<LoginForm handleSubmit={(e) => handleSubmit(e)}/> | |
</div> | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment