Last active
October 12, 2017 04:26
-
-
Save wasabigeek/90437eaebf439ea18b2326a941fb14c5 to your computer and use it in GitHub Desktop.
An Incremental Approach to React with Django: React-Router - Before Refactoring
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- /templates/app/a.html --> | |
<div id="reactComponent"></div> | |
<!-- /templates/app/b.html --> | |
<div id="reactComponent"></div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// /static/js/app/a.js | |
ReactDOM.render( | |
<PageAComponent/> | |
document.getElementById('reactComponent') | |
) | |
// /static/js/app/b.js | |
ReactDOM.render( | |
<PageBComponent/> | |
document.getElementById('reactComponent') | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /app/urls.py | |
urlpatterns = [ | |
url(r'^a/', TemplateView.as_view(template_name="/app/a.html")), | |
url(r'^b/', TemplateView.as_view(template_name="/app/b.html")), | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /project/urls.py | |
urlpatterns = [ | |
url(r'^app/', include('app.urls', namespace='app')), | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment