Is it possible to use components that are dynamically defined in memory? #1019
-
Hi all. I'm a big fan of ReactPy. I have a situation where the user interface needs to be generated programmatically in Python. I've gone through the ReactPy Django tutorial of defining component functions which are imported by HTML templates. I can imagine that it's possible to dynamically generate an HTML template that imports a variety of pre-defined components, and programmatically add further customization via key / value pairs in the HTML template. However, generating a HTML template programmatically doesn't seem like a straightforward thing to do. So I wonder if the following is possible:
Many thanks for your assistance! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 9 replies
-
I think it would be useful to know what you're trying to accomplish. Components that are loaded into templates must indeed be statically defined (unless, as you said you get clever when generating your templates), but inside those components you can have dynamic behavior. |
Beta Was this translation helpful? Give feedback.
Perhaps there's some detail of your application I'm not aware of, but it seems like
get_panel_element_definitions
could just call your users code couldn't it? I could imagine wanting to save it as a JSON file for performance reasons though so you don't have to re-run your users code on ever page visit.