reactjs - React-Tab id tag not working how do I getElementByID?
问题描述
I have a react app, there is a tab list:
render() {
return (
<div className="App">
<Tabs>
<TabList>
<Tab id="abc">ABC</Tab>
<Tab>DEF</Tab>
</TabList>
</Tabs>
</div>
);
}
In the console getElementById("abc") returns null. Why?
Proper way to get an element in React JS code?
解决方案
我认为您的意思是document.getElementById("abc")
(注意小写d)
推荐阅读
- r - 我无法从 R 中正确保存图
- c# - UPW webrtc_PeerCC 到 PeerCC 浏览器
- javascript - Firestore 规则 - 查询文档是否存在 - 权限不足
- pdf - 在不更改布局和格式的情况下,在 python 中从 pdf 中提取文本的最佳方法是什么?
- bash - 协助 awk/bash 绘制内存差异
- java - 未能创建目录:Android
- python - 通过 Azure Active Directory (AKS) 对 kubernetes api 进行身份验证
- angular - Angular找不到变量缓存
- angular - 离子 - inappbrowser.close 不是函数
- parsing - 有没有办法忽略 Snake yaml 中的超类属性