React
Hooks
import React, { useRef } from 'react'
import { Link } from 'react-router-dom'
const Authentication = () => {
const emailRef = useRef(null)
const passwordRef = useRef(null)
const handleSubmit = event => {
event.preventDefault()
console.log('--->', emailRef.current.value, passwordRef.current.value)
}
return (
<div className="auth-page">
<div className="container page">
<div className="row">
<div className="col-md-6 offset-md-3 col-xs-12">
<h1 className="text-xs-center">Sign in</h1>
<p className="text-xs-center">
<Link to="/register">Need an account?</Link>
</p>
<form onSubmit={handleSubmit}>
<fieldset>
<fieldset className="form-group">
<input
type="email"
className="form-control form-control-lg"
placeholder="Email"
ref={emailRef}
/>
<input
type="password"
className="form-control form-control-lg"
placeholder="Password"
ref={passwordRef}
/>
</fieldset>
<button
className="btn btn-lg btn-primary pull-xs-right"
type="submit"
>
Sign in
</button>
</fieldset>
</form>
</div>
</div>
</div>
</div>
)
}
export default AuthenticationCreate React App
Use Create React App local template from your template root folder
Create React App local template folder structure and gitignore
How to create custom Create React App (CRA) templates
Last updated