From 1e6a94fff4f7506f480104942226e20b51d94bd7 Mon Sep 17 00:00:00 2001 From: Fabio Kapsahili Date: Tue, 9 Jan 2024 12:21:26 +0100 Subject: [PATCH 1/2] Add basic react 18 support --- .../templates/react_print.html | 36 ++++++++++++++----- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/django_react_templatetags/templates/react_print.html b/django_react_templatetags/templates/react_print.html index 008c7a9..317fba5 100644 --- a/django_react_templatetags/templates/react_print.html +++ b/django_react_templatetags/templates/react_print.html @@ -2,14 +2,34 @@ {% for component in components %} {{ component.json_obj|json_script:component.data_identifier }} {% endfor %} {% endif %} From 88901e1f198431b77011963517fceb9c9942d1c9 Mon Sep 17 00:00:00 2001 From: Fabio Kapsahili Date: Tue, 9 Jan 2024 14:38:40 +0100 Subject: [PATCH 2/2] Fix indents --- django_react_templatetags/templates/react_print.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/django_react_templatetags/templates/react_print.html b/django_react_templatetags/templates/react_print.html index 317fba5..29eb75a 100644 --- a/django_react_templatetags/templates/react_print.html +++ b/django_react_templatetags/templates/react_print.html @@ -23,12 +23,12 @@ } else { ReactDOM.{{ ssr_available|yesno:"hydrate,render" }}( React.createElement({{ component.name }}, JSON.parse(document.getElementById("{{ component.data_identifier }}").textContent)), - {% if ssr_available and component.ssr_params.hypernova_id %} + {% if ssr_available and component.ssr_params.hypernova_id %} document.querySelector('div[data-hypernova-id="{{ component.ssr_params.hypernova_id }}"]') - {% else %} + {% else %} document.getElementById('{{ component.identifier }}') - {% endif %} - ); + {% endif %} + ); } {% endfor %}