Skip to Content
全栈Serverless
book

全栈Serverless

by Nader Dabit
March 2022
Intermediate to advanced
205 pages
3h 9m
Chinese
China Electric Power Press Ltd.
Content preview from 全栈Serverless
自定义身份验证策略
|
95
/>
)
case 'forgotPasswordSubmit':
return (
<ForgotPasswordSubmit
forgotPasswordSubmit={
() => forgotPasswordSubmit(formState, updateFormType)}
updateFormState={e => updateForm(e)}
/>
)
default:
return null
}
}
renderForm
函数将检查状态中设置的当前
formType
并呈现合适的表单。随着
formType
的变化,将调用
renderForm
并根据
formType
重新渲染正确的表单。
5.2.9
表单类型切换
需要在该组件中做的最后一件事是渲染按钮,使得用户能够在不同的表单
状态之间手动切换。需要切换的三种表单状态分别是
signIn, signUp
和
forgotPassword
。
为此,让我们更新
Form
函数的
return
语句,使其返回一些按钮,这些按钮
允许用户切换不同的表单类型:
return (
<div>
{renderForm()}
{
formType === 'signUp' && (
<p style={styles.toggleForm}>
Already have an account? <span ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

人工智能技术与大数据

人工智能技术与大数据

Posts & Telecom Press, Anand Deshpande, Manish Kumar
编写整洁的Python代码(第2版)

编写整洁的Python代码(第2版)

Posts & Telecom Press, Mariano Anaya
Kafka权威指南(第2版)

Kafka权威指南(第2版)

Gwen Shapira, Todd Palino, Rajini Sivaram, Krit Petty
写给系统管理员的Python脚本编程指南

写给系统管理员的Python脚本编程指南

Posts & Telecom Press, Ganesh Sanjiv Naik

Publisher Resources

ISBN: 9787519864453