Skip to content

Instantly share code, notes, and snippets.

@pirate
Last active February 23, 2017 22:30
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save pirate/1e83616c3361136f309648f7bc635280 to your computer and use it in GitHub Desktop.
Base template for react pages
{% extends "ui/base.html" %}
{% block title %}{{title}}{% endblock %}
{% block inner %}
<div id="react">
<!-- Contents get replaced by mounted React.Component -->
<i class="fa fa-lg fa-spinner fa-spin"></i><br><br>
<i class="pending">Loading components...</i><br><br>
</div>
<script>
window.props = {{props|json}}; // make sure to escape your props to prevent XSS! See here for the source for the json filter: https://gist.github.com/pirate/c18bfe4fd96008ffa0aef25001a2e88f
window.react_mount = document.getElementById('react');
</script>
<script src="/static/src/{{component}}"></script>
{% endblock %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment