Skip to content

Move empty to React.Basic #34

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions generated-docs/React/Basic.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,16 @@ createElementKeyed :: forall props. ReactComponent { | props } -> { key :: Stri
Like `createElement`, plus a `key` for rendering components in a dynamic list.
For more information see: https://reactjs.org/docs/reconciliation.html#keys

#### `empty`

``` purescript
empty :: JSX
```

An empty node. This is often useful when you would like to conditionally
show something, but you don't want to (or can't) modify the `children` prop
on the parent node.

#### `fragment`

``` purescript
Expand Down
10 changes: 0 additions & 10 deletions generated-docs/React/Basic/DOM.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,6 @@ text :: String -> JSX

Create a text node.

#### `empty`

``` purescript
empty :: JSX
```

An empty node. This is often useful when you would like to conditionally
show something, but you don't want to (or can't) modify the `children` prop
on the parent node.

#### `CSS`

``` purescript
Expand Down
8 changes: 8 additions & 0 deletions src/React/Basic.purs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module React.Basic
, stateless
, createElement
, createElementKeyed
, empty
, fragment
, fragmentKeyed
, JSX
Expand All @@ -15,6 +16,7 @@ import Prelude
import Control.Monad.Eff (Eff, kind Effect)
import Control.Monad.Eff.Uncurried (EffFn3, mkEffFn3)
import Data.Function.Uncurried (Fn2, Fn3, mkFn3, runFn2)
import Unsafe.Coerce (unsafeCoerce)

-- | A virtual DOM element.
foreign import data JSX :: Type
Expand Down Expand Up @@ -88,6 +90,12 @@ createElementKeyed
-> JSX
createElementKeyed = runFn2 createElementKeyed_

-- | An empty node. This is often useful when you would like to conditionally
-- | show something, but you don't want to (or can't) modify the `children` prop
-- | on the parent node.
empty :: JSX
empty = unsafeCoerce false

-- | Render an Array of children without a wrapping component.
foreign import fragment :: Array JSX -> JSX

Expand Down
6 changes: 0 additions & 6 deletions src/React/Basic/DOM.purs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,6 @@ import Unsafe.Coerce (unsafeCoerce)
text :: String -> JSX
text = unsafeCoerce

-- | An empty node. This is often useful when you would like to conditionally
-- | show something, but you don't want to (or can't) modify the `children` prop
-- | on the parent node.
empty :: JSX
empty = unsafeCoerce false

-- | An abstract type representing records of CSS attributes.
foreign import data CSS :: Type

Expand Down