reflex
reflex copied to clipboard
Allow custom JS code
The user should be able to give a string of custom JS code that will be compiled to the top of the page.
I can also work on this. How would the feature look like in code? Sth like this?:
app = pc.App()
app.add_page(index, custom_js_scripts=[js_code_str_1, js_code_str_2])
I can also work on this. How would the feature look like in code? Sth like this?:
app = pc.App() app.add_page(index, custom_js_scripts=[js_code_str_1, js_code_str_2])
Maybe add a pc.script function? and we can choose where the script should be placed.
Interestingly we have already had a pc.script. It looks to me it's a nextjs NextScript object.
I'll suggest we rename the pc.script to NextScript
instead. I think this component is only used internally in the framework so it's probably fine. And create a Script
component.
This would be an awesome feature to have.