Closed napretep closed 2 years ago
oh, I solved it by adding a simple modified version in myself code file.
module app.common.modifies
[<RequireQualifiedAccess>]
module Program =
open Elmish.React
open Browser.Types
module Internal =
open Fable.React
open Elmish
let withReactSynchronousUsing' lazyView2With (appEntrance:HTMLElement) (program:Elmish.Program<_,_,_,_>) =
let setState =
fun model dispatch ->
ReactDom.render(
lazyView2With (fun x y -> obj.ReferenceEquals(x,y)) (Program.view program) model dispatch,
appEntrance
)
program
|> Program.withSetState setState
let withReactSynchronous' (appEntrance:HTMLElement) (program:Elmish.Program<_,_,_,_>) =
Internal.withReactSynchronousUsing' lazyView2With appEntrance program
hi there, I want to render react app in a shadowroot, which is the element that normal document cannot find by method
document.getElementById.
Unfortunately,
Program.withReactSynchronous
uses exactly thedocument.getElementById
method to locate the root node, which makes it impossible to achieve my goal.so what should I do? Is there any other way to run react app in a shadowroot?
I' m not sure where to post the question, to feliz or elmish?