reflex icon indicating copy to clipboard operation
reflex copied to clipboard

Allow custom JS code

Open picklelo opened this issue 2 years ago β€’ 5 comments

The user should be able to give a string of custom JS code that will be compiled to the top of the page.

picklelo avatar Jan 17 '23 00:01 picklelo

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])

TommyDew42 avatar Jan 24 '23 19:01 TommyDew42

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.

FHU-yezi avatar Jan 25 '23 00:01 FHU-yezi

Interestingly we have already had a pc.script. It looks to me it's a nextjs NextScript object.

TommyDew42 avatar Jan 28 '23 06:01 TommyDew42

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.

TommyDew42 avatar Jan 28 '23 07:01 TommyDew42

This would be an awesome feature to have.

jq6l43d1 avatar Jun 08 '23 03:06 jq6l43d1