Skip to content

Commit

Permalink
Merge pull request vasanthk#43 from adonis-work/patch-1
Browse files Browse the repository at this point in the history
Update 04.conditional-rendering.md
  • Loading branch information
vasanthk authored Mar 31, 2017
2 parents e8af3d3 + 335b8eb commit ddab874
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions patterns/04.conditional-rendering.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,14 @@ const Oops = ({showFirst, dontShowSecond}) => (
```

if you use `<Oops showFirst={0} dontShowSecond={1}/>` you will get `01` instead of the empty space you may be expecting.

This can be avoided using !! to convert values to boolean before use:

```js
const Oops = ({showFirst, dontShowSecond}) => (
<div>
{!!showFirst && 'first'}
{!!dontShowSecond || 'second'}
</div>
)
```

0 comments on commit ddab874

Please sign in to comment.