[英]How to add custom data-* attributes in react-bootstrap component
I am using react-bootstrap for 'atom' level components in my react app and I want to pass HTML5 data-* attributes to those component and even though I do pass them in my react-bootstrap component ( Button in my case) they do not show up and when I inspect them and hence I am not able to use them 我在我的react应用程序中将React-bootstrap用于'atom'级组件,并且我想将HTML5 data- *属性传递给那些组件,即使我确实在我的react-bootstrap组件中传递它们(在我的案例中为Button )没有出现,当我检查它们时,因此我无法使用它们
Now Is there a way to do that? 现在有办法做到吗? I have went through their documentation but there is no clue as to how to do that?
我已经阅读了他们的文档,但是没有关于如何执行此操作的线索?
DOM attributes that use data-*
will not be altered in React. 使用
data-*
DOM属性不会在React中更改。
There are stricter rules around non-data attributes as of React 16, but as you can read here , the data-attributes are left in. 从React 16开始,关于非数据属性的规则更加严格,但是正如您在此处所看到的那样 ,数据属性仍然保留。
With React Bootstrap, certain elements have had issues receiving data-attributes, if they map to say a list of 使用React Bootstrap时,如果某些元素映射为表示以下内容的列表,则某些元素在接收数据属性时会遇到问题
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.