I think that the Environment.CreateComponent does a side effect of adding a component to _components list, and is overlooked when using ReactWithInit.
|
var reactComponent = Environment.CreateComponent(componentName, props, containerId, clientOnly); |
At least we should be able to remove the rendered component from list of _components once it's successfully added to the markup.
I realized this was going on because I couldn't use get ReactWithInit to work without throwing me the ReactDOM is undefined error in console. Realized that it's working because it sort of fallbacks to default behavior and just adds the component to the render/hydrate list at the bottom of the page, after all react dependencies are loaded.
I'm using v4.1.0 on the project but I think this is applicable to v5.0 as well.
I think that the
Environment.CreateComponentdoes a side effect of adding a component to_componentslist, and is overlooked when usingReactWithInit.React.NET/src/React.AspNet/HtmlHelperExtensions.cs
Line 127 in 7ed661e
At least we should be able to remove the rendered component from list of
_componentsonce it's successfully added to the markup.I realized this was going on because I couldn't use get
ReactWithInitto work without throwing me theReactDOMis undefined error in console. Realized that it's working because it sort of fallbacks to default behavior and just adds the component to the render/hydrate list at the bottom of the page, after all react dependencies are loaded.I'm using
v4.1.0on the project but I think this is applicable tov5.0as well.