Hi @FrankT,
What you’re proposing looks thoroughly achievable! If you’re building something in JS, the approach I’d recommend is to build the JS project with a standard JS toolchain (Webpack, etc), bundling it into a single .js
file with all it’s dependencies. Then include that file in your Anvil assets, and use anvil.js
to access the JS libraries from your Python code. You’ll probably want to check your app out in Git and have a shell script/batch file/build step that builds your JS code, copies the bundle into your Anvil app, commits it and pushes it up into Anvil (that’s what I do in those cases).
Remember that most Anvil components use concrete DOM nodes rather than React’s virtual DOM, so you’ll want your JS module to have an entrypoint for “render what you want to into [this DOM node]”.
Finally, if it makes sense, wrap your JS library into a Custom Component written in Python (or a module if you don’t need UI), so that non-Javascript programmers can grab it and use it!