In the Blazor WebAssembly App, I would like to embed a Razor component in a div element newly added on the JavaScript side. Please let me know if there is a better way.
<Sample></Sample>)-> Nothing is shown.
-> Not Found. (Because this is a WebAssembly app, component pages are not rendered if we request to a server.)
If you have prepared the Simple.Razor component in advance, one way you can achieve this is assign this component under if condition as follows,
@If(visible==true){<div><simple></simple></div>}
and on press of a button change visible variable in a function followed by,
StateHasChanged()
and it will do what you want this way you dont have to do JSInjection.