Hi, I’m playing around with the various approaches to creating HTML templates and invoking JS functions. I’m quite liking the nxtedition create-caspar-graphics solution with its ReactJS components approach but I’m completely stumped by how to expose JS functions from within the component.
I suspect the React app hides everything so any invoke fails. Has anyone figured this one out?
Sounds like a React question to me. There should be a lot of React specific tutorials and how to’s in the wide internet. Stack Overflow is a good starting point.
Thanks Didi, already had a look on SO. As far as I can tell the nxtedition solution wraps the React app and the output doesn’t lend itself to easy modification to create the reference to the component in order to call the function.
My ‘solution’ (which is a bit of a fudge) is to use a data field to pass in the name of the function via an UPDATE rather than INVOKE and extract it during the properties change lifecycle.
Still hoping someone can tell me I’m barking up the wrong tree and there’s a really simple way!