reactjs - 使用 AmplifyGreetings 显示用户名
问题描述
我有一个使用 Amazon Amplify 框架开发的反应应用程序。根据文档,我试图在Signout
按钮之前检索我的用户名(我在注册过程中指定的)。该文档没有明确说明如何显示我的用户名,因为该<AmplifyGreetings>
组件放置了一个用户名的虚拟属性。有人可以指导我如何做到这一点吗?
代码:App.js
import React from "react";
import { withAuthenticator, AmplifyGreetings } from "@aws-amplify/ui-react";
class App extends React.Component {
render() {
return (
<div>
<AmplifyGreetings username="retrieve your username here"></AmplifyGreetings>
</div>
);
}
}
export default withAuthenticator(App);
解决方案
推荐阅读
- php - 有没有办法在php的不同位置包含相同的文件
- flutter - Flutter 中更新 state 对象后 hookwidget 不重新渲染
- python - 如何从函数返回布尔值?
- node.js - 我在 discord.js 中的静音命令不起作用
- google-cloud-dataflow - 数据流 - distinct 卡在 3MB 的数据中并扼杀了吞吐量
- android - 如何解决flutter中的渲染溢出问题?
- reactjs - 如果输入只接受数字,则反应测试
- html - 如何在 SQL 查询中使用来自多个 Html 复选框的值?
- python - ValueError: I/O operation on closed file 为什么会这样?用 python book 自动化无聊的东西
- c - 为什么 FILE 结构总是用指针表示而不是自动变量?