Skip to content

Commit d05fcb8

Browse files
Merge pull request #113 from vbfox/nothing
Add nothing to react helpers
2 parents 4a0a4c5 + 5215892 commit d05fcb8

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/Fable.React/Fable.Helpers.React.fs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -884,6 +884,10 @@ let inline ofList (els: ReactElement list): ReactElement = unbox(List.toArray el
884884
/// Returns an array **from .render() method**
885885
let inline ofArray (els: ReactElement array): ReactElement = unbox els
886886

887+
/// A ReactElement when you don't want to render anything (null in javascript)
888+
[<Emit("null")>]
889+
let nothing: ReactElement = jsNative
890+
887891
[<RequireQualifiedAccess>]
888892
module ReactElementType =
889893
let inline ofComponent<'comp, 'props, 'state when 'comp :> Component<'props, 'state>> : ReactComponentType<'props> =
@@ -966,6 +970,9 @@ let inline ofList (els: ReactElement list): ReactElement = HTMLNode.List els :>
966970
/// Returns an array **from .render() method**
967971
let inline ofArray (els: ReactElement array): ReactElement = HTMLNode.List els :> ReactElement
968972

973+
/// A ReactElement when you don't want to render anything (null in javascript)
974+
let nothing: ReactElement = HTMLNode.Empty :> ReactElement
975+
969976
#endif
970977

971978

0 commit comments

Comments
 (0)