You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Removed automatic translation. Added component bundling and mount functionality.
Babel translation is now opt-in, rather than the default. Rather than using Babel's require hook to load components, it is now used as part of the bundling process. This removes the massive overhead that it introduced when loading files in the same process as the renderer. It also removes the requirement for translated files to use the `jsx` extension, which had been used as a whitelist hack to get around the aforementioned overhead.
If you want to continue as before, just add `translate=True` to your render_component calls.
The bundling/mounting functionality is similar to what previously existed when django-react and django-webpack were more tightly coupled. The primary difference is that it is now opt-in, rather than the default.
Re markfinger#24
mount_js='''if (typeof React === 'undefined') throw new Error('Cannot find `React` global variable. Have you added a script element to this page which points to React?');
64
+
if (typeof {var} === 'undefined') throw new Error('Cannot find component variable `{var}`');
65
+
(function(React, component, containerId) {{
66
+
var props = {props};
67
+
var element = React.createElement(component, props);
68
+
var container = document.getElementById(containerId);
69
+
if (!container) throw new Error('Cannot find the container element `#{container_id}` for component `{var}`');
0 commit comments