We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 54453cc commit dbead22Copy full SHA for dbead22
src/Fable.React/Fable.Helpers.ReactServer.fs
@@ -719,11 +719,13 @@ let rec private addReactMark htmlNode =
719
HTMLNode.List (nodes |> Seq.cast |> Seq.map addReactMark |> Seq.cast)
720
| h -> h
721
722
-let inline private castHTMLNode (htmlNode: ReactElement): HTMLNode =
723
- if isNull htmlNode then
724
- HTMLNode.Empty
725
- else
726
- htmlNode :?> HTMLNode
+/// Cast a ReactElement safely to an HTMLNode.
+/// Returns an empty node if input is not an HTMLNode.
+let inline castHTMLNode (htmlNode: ReactElement): HTMLNode =
+ match htmlNode with
+ | :? HTMLNode as node -> node
727
+ | _ -> HTMLNode.Empty
728
+
729
730
module Raw =
731
/// Writes the nodes into a TextWriter. DOESN'T ADD `reactroot` attribute.
0 commit comments