@@ -767,12 +767,6 @@ type ServerElementType =
767
767
let [<Literal>] private ChildrenName = " children"
768
768
769
769
module ServerRenderingInternal =
770
- let inline isomorphicExec ( clientFn : 'a -> 'b ) ( serverFn : 'a -> 'b ) ( input : 'a ) =
771
- #if FABLE_ COMPILER
772
- clientFn input
773
- #else
774
- serverFn input
775
- #endif
776
770
777
771
#if FABLE_ COMPILER
778
772
let inline createServerElement ( tag : obj , props : obj , children : ReactElement list , elementType : ServerElementType ) =
@@ -821,14 +815,11 @@ let inline from<[<Pojo>]'P> (com: ComponentClass<'P>) (props: 'P) (children: Rea
821
815
/// Instantiate a component from a type inheriting React.Component
822
816
/// Example: `ofType<MyComponent,_,_> { myProps = 5 } []`
823
817
let inline ofType < 'T ,[< Pojo >] 'P ,[< Pojo >] 'S when 'T :> Component < 'P , 'S >> ( props : 'P ) ( children : ReactElement list ): ReactElement =
824
- let inline clientRender () =
825
- createElement( typedefof< 'T>, props, children)
826
-
827
- let inline serverRender () =
828
- createServerElement( typeof< 'T>, props, children, ServerElementType.Component)
829
-
830
- isomorphicExec clientRender serverRender ()
831
-
818
+ #if FABLE_ COMPILER
819
+ createElement( typedefof< 'T>, props, children)
820
+ #else
821
+ createServerElement( typeof< 'T>, props, children, ServerElementType.Component)
822
+ #endif
832
823
833
824
834
825
/// OBSOLETE: Use `ofType`
@@ -843,8 +834,11 @@ let inline com<'T,[<Pojo>]'P,[<Pojo>]'S when 'T :> Component<'P,'S>> (props: 'P)
843
834
/// ofFunction Hello { name = "Maxime" } []
844
835
/// ```
845
836
let inline ofFunction <[< Pojo >] 'P > ( f : 'P -> ReactElement ) ( props : 'P ) ( children : ReactElement list ): ReactElement =
846
- isomorphicExec createElement createServerElementByFn ( f, props, children)
847
-
837
+ #if FABLE_ COMPILER
838
+ createElement( f, props, children)
839
+ #else
840
+ createServerElementByFn( f, props, children)
841
+ #endif
848
842
849
843
/// OBSOLETE: Use `ofFunction`
850
844
[<System.Obsolete( " Use ofFunction" ) >]
@@ -915,41 +909,35 @@ let inline ofArray (els: ReactElement array): ReactElement = HTMLNode.List els :
915
909
916
910
/// Instantiate a DOM React element
917
911
let inline domEl ( tag : string ) ( props : IHTMLProp list ) ( children : ReactElement list ): ReactElement =
918
- let inline clientRender ( tag , props , children ) =
919
- createElement( tag, keyValueList CaseRules.LowerFirst props, children)
920
-
921
- let inline serverRender ( tag , props , children ) =
922
- createServerElement( tag, ( props |> Seq.cast< IProp>), children, ServerElementType.Tag)
923
-
924
- isomorphicExec clientRender serverRender ( tag, props, children)
912
+ #if FABLE_ COMPILER
913
+ createElement( tag, keyValueList CaseRules.LowerFirst props, children)
914
+ #else
915
+ createServerElement( tag, ( props |> Seq.cast< IProp>), children, ServerElementType.Tag)
916
+ #endif
925
917
926
918
/// Instantiate a DOM React element (void)
927
919
let inline voidEl ( tag : string ) ( props : IHTMLProp list ) : ReactElement =
928
- let inline clientRender ( tag , props , children ) =
929
- createElement( tag, keyValueList CaseRules.LowerFirst props, children)
930
-
931
- let inline serverRender ( tag , props , children ) =
932
- createServerElement( tag, ( props |> Seq.cast< IProp>), children, ServerElementType.Tag)
933
-
934
- isomorphicExec clientRender serverRender ( tag, props, [])
920
+ #if FABLE_ COMPILER
921
+ createElement( tag, keyValueList CaseRules.LowerFirst props, [])
922
+ #else
923
+ createServerElement( tag, ( props |> Seq.cast< IProp>), [], ServerElementType.Tag)
924
+ #endif
935
925
936
926
/// Instantiate an SVG React element
937
927
let inline svgEl ( tag : string ) ( props : IProp list ) ( children : ReactElement list ): ReactElement =
938
- let inline clientRender ( tag , props , children ) =
939
- createElement( tag, keyValueList CaseRules.LowerFirst props, children)
940
- let inline serverRender ( tag , props , children ) =
941
- createServerElement( tag, ( props |> Seq.cast< IProp>), children, ServerElementType.Tag)
942
-
943
- isomorphicExec clientRender serverRender ( tag, props, children)
928
+ #if FABLE_ COMPILER
929
+ createElement( tag, keyValueList CaseRules.LowerFirst props, children)
930
+ #else
931
+ createServerElement( tag, ( props |> Seq.cast< IProp>), children, ServerElementType.Tag)
932
+ #endif
944
933
945
934
/// Instantiate a React fragment
946
935
let inline fragment ( props : IFragmentProp list ) ( children : ReactElement list ): ReactElement =
947
- let inline clientRender () =
948
- createElement( typedefof< Fragment>, keyValueList CaseRules.LowerFirst props, children)
949
- let inline serverRender () =
950
- createServerElement( typedefof< Fragment>, ( props |> Seq.cast< IProp>), children, ServerElementType.Fragment)
951
-
952
- isomorphicExec clientRender serverRender ()
936
+ #if FABLE_ COMPILER
937
+ createElement( typedefof< Fragment>, keyValueList CaseRules.LowerFirst props, children)
938
+ #else
939
+ createServerElement( typedefof< Fragment>, ( props |> Seq.cast< IProp>), children, ServerElementType.Fragment)
940
+ #endif
953
941
954
942
// Standard elements
955
943
let inline a b c = domEl " a" b c
0 commit comments