ReactiveHTML renders from file

Hi All,
I am trying to develop a custom component with ReactiveHTML panel component and Leaflet. Due to my requirements, the render part of the custom component is getting bigger and bigger :slight_smile: . My question is if it is possible to supply the render part or the entire _script part from a .js file?

Thank you,

you can use

from pathlib import Path
_scripts = {'render': (Path(__file__).parent / 'filename.js').read_text('utf-8')}
2 Likes

Hi @FBT

There is a Feature Request to improve the developer experience of ReactiveHTML including using one or more seperate js files here #2929.

Please join the discussion and upvote if you think this is important.

Thank you @nghenzi for the solution and @Marc I agree that a component that is as strong as ReactiveHTML can be more robust and have better developer experience. I have upvoted the issue, and will try to look for ways of assistance on the issue.

1 Like