reactjs - Pass props from template into react.js root node -
i may have missed something, here goes. if have:
var swoosh = react.createclass({ render: function() { return ( <div classname="swoosh"> boom. </div> ); } }); react.rendercomponent( <swoosh />, document.getelementbyid('content') );
can set props
attributes on mount point (where id='content'
)?
<div id='content' foo='alice' bar='has' bav='a cat' /> <!-- have foo, bar & bav available props in <swoosh />? -->
no, though of course can do:
var container = document.getelementbyid('content'); react.rendercomponent( <swoosh foo={container.getattribute('foo')} bar={container.getattribute('bar')} bav={container.getattribute('bav')} />, container );
(or if want make attributes dict using https://stackoverflow.com/a/5282801/49485, can swoosh(attributes)
).
Comments
Post a Comment