javascript - 尝试查看输出时如何使用 console.log?
问题描述
例如,声明activeTabIndex
如何查看我是否设置了 activeTabIndex 事件?
这是代码:
<TouchableOpacity onPress={() => setActiveTabIndex(0)} style={{ width: Dimensions.get("window").width / 4, padding: 5, alignItems: "center" }}>
<Home height={30} width={22} fill={activeTabIndex == 0 ? "blue" : "#d4e6f1"} />
</TouchableOpacity>
在哪里写 console.log(activeTabIndex) 什么的)
解决方案
- 您可以将 activeTabIndex 绑定到您的 JSX 模板,例如。
{activeTabIndex}
- 您可以在
setActiveTabIndex()
方法中添加一个 console.log(index) 以查看它是否被触发。
推荐阅读
- javascript - 无论我尝试什么,我的不和谐机器人自然会阻止 DM 选项
- javascript - 如何使输入框只接受浮动输入
- flutter - 颤振:'google_sign_in' pub 构建失败#import
- java - Java RegExp '?' 的行为 和'+'
- macos - 如何在 macOS 上运行虚拟键盘(Catalina / Big Sur)
- php - 使用 Laravel 批量上传和添加文件到数据库
- php - 如何用 Gettext 正确包装它?
- windows-subsystem-for-linux - Elm 安装总是因“ConnectionTimeout”错误而失败(在 WSL 中)
- azure-data-factory - 在添加了文件的新容器上触发 Azure 数据工厂事件
- c++ - 编写一个程序来纠正字符串中的多余字符