Skip to content

Instantly share code, notes, and snippets.

@mikekoro
Created May 9, 2020 05:44
Show Gist options
  • Save mikekoro/c160fb1b7794fa2293d1e4139fb109da to your computer and use it in GitHub Desktop.
Save mikekoro/c160fb1b7794fa2293d1e4139fb109da to your computer and use it in GitHub Desktop.
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