javascript - What's the correct syntax for Data-Toggle Bootstrap on React.js -
so i'm new react , javascript in general, trying lay out how see in html
el.button({ type: 'button', classname: 'navbar-toggle', data-toggle: 'collapse', // syntax error here data-target: 'navbar' // syntax error here }, el.span({ classname: 'sr-only' }, 'toggle navigation'), el.span({ classname: 'icon-bar' }), el.span({ classname: 'icon-bar' }), el.span({ classname: 'icon-bar' }) ),
using purely js react.js
from react docs on dom differences bit tucked away,
"all dom properties , attributes (including event handlers) should camelcased consistent standard javascript style. intentionally break spec here since spec inconsistent. however, data-* , aria-* attributes conform specs , should lower-cased only."
that helps determine cases, have correctly, since hypens not allowed javascript variable names default need quote identifiers.
so, using example, notation works me of react 0.13.3 is:
el.button({ type: 'button', classname: 'navbar-toggle', "data-toggle": 'collapse', // syntax error here "data-target": 'navbar' // syntax error here },
Comments
Post a Comment