简体   繁体   中英

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

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.

There are stricter rules around non-data attributes as of React 16, but as you can read here , the data-attributes are left in.

With React Bootstrap, certain elements have had issues receiving data-attributes, if they map to say a list of

  • items. If you show your JSX it might make diagnosing easier.

  • The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

     
    粤ICP备18138465号  © 2020-2024 STACKOOM.COM