Created
May 9, 2020 05:44
-
-
Save mikekoro/c160fb1b7794fa2293d1e4139fb109da 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
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