How can I add code/tags in the head section of the html doc? Seems like the app is being generated on the fly. Which makes me wonder if prerendering the app is the way to go. My head is spinning. Is UD generating and serving the react app on the fly? Then the browser has to ‘unpack’ the spa? Is even mentioning prerendering/ssr even the correct line of thinking here? I really don’t understand what’s happening under the hood.
If you want to see what’s going on, you can always check out the code: https://github.com/ironmansoftware/universal-dashboard/tree/master/src
I’ll put this on the list of blog posts to write because I think it would be good for everyone to understand the guts.
Mostly, there are react components already built and they are being instantiated via PowerShell. When you use New-UDElement, you’re really building your own React elements. Aside from that, the components are all defined in JSX: https://github.com/ironmansoftware/universal-dashboard/tree/master/src/client/src/app
The components receive their props from the cmdlets. The render service decides which component to render based on the JSON sent down from the server: https://github.com/ironmansoftware/universal-dashboard/blob/master/src/client/src/app/services/render-service.jsx
In newer releases, it’s becoming easier to integrate custom React controls to load custom JS packages into UD. These packages can come in just as modules and those components are compiled into their on set of JS files: https://github.com/ironmansoftware/universal-dashboard/tree/master/src/UniversalDashboard.MaterialUI
I could nerd out about this forever