-
Notifications
You must be signed in to change notification settings - Fork 920
Description
I have a scenario where I have a few independent components on a page accessing data from a "central store". The central store needs to be initialized before the components first render.
My first solution was (before introducing server side rendering), to simply call store.initialize()
before React.render()
Now I would need to somehow call store.initialize()
on the server before calling @Html.React()
in the same JS context.
I could call ReactSiteConfiguration.Configuration.AddScript()
on a file that initializes the store, but that runs on every page of my application.
I want to initialize the store on specific pages only.
I would somehow need to get the JavaScript engine instance that React.NET uses from JsEngineSwitcher
and call Execute("store.initialize();")
on it.
Can I do that?