javascript - Use non-specification attribute in React JSX? Such as ng-href -
i'm getting familiar react , thinking of gradually moving angular app on it. now, have 1 react component on site. however, need have element ui-href
attribute in react component. tried putting in string, so:
<a { "ui-href='" + this.props.statelink + "'" } >...</a>
but no joy, says error unexpected string.
i read can prefix custom attributes data-
make make them work, , that's true, keeps data-
attached, e.g. data-ui-href
actual final attribute creates.
any known workaround?
i think unexpected string error occurring because mixing angular & react syntax. try instead:
<a data-ui-href={this.props.statelink} >...</a>
it keep data-
prefix in attribute though. not sure workaround is.
Comments
Post a Comment