我想从Twig模板中呈现一个ReactJS组件。这是否可行?
我尝试了:
在JS方面:
出现错误:
我尝试了:
<div class="top-line">
<h1>{{ username }}</h1>
{% verbatim %}
<script type="text/html" id="follow-button"></script>
{% endverbatim %}
<div id="follow-button-mp"></div>
</div>
在JS方面:
React.render(
React.createElement(document.getElementById('follow-button').innerHTML),
document.getElementById('follow-button-mp')
);
出现错误:
Uncaught Error: Invariant Violation: Invalid tag:
<FriendshipButton user={{ app.user }} />