Skip to content

React template inside Django template? #277

Answered by silviogutierrez
Adamcina asked this question in Q&A
Discussion options

You must be logged in to vote

Great question. Not in the official package.

I actually created the inverse code for a project of mine. You can replace top level templates with React, but the "inner" blocks-only templates continue being rendered by Django. To ease transition. The idea being that rewriting one "base.html" once to React but leaving dozens of "widget_detail.html", "trinket_detail.html" etc made more sense.

FYI you could just inject the "static/dist/index.js" file in there and render React into #app without React.render, but obviously you lose SSR and at this point are just using the Reactivated bundling tools and not the renderer.

I'll have to explore what common "transition" scenarios are.

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
3 replies
@Adamcina
Comment options

@silviogutierrez
Comment options

@Adamcina
Comment options

Answer selected by silviogutierrez
Comment options

You must be logged in to vote
2 replies
@silviogutierrez
Comment options

@burakakca
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants