Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

if.jsx

1.0.0 • Public • Published

if.jsx Build Status

Simple if condition helper for JSX.

This module is an implementation of this tweet. It's highly recommended to read the whole thread, since you may find out that you don't actually need this module.

Install

npm install --dev if.jsx

Usage

import If from 'if.jsx'
 
// ...
 
return <div className='foobar'>
  {If(showHeader) (
    <h1>Header</h1>
  )}
  <div className='body'>body</div>
</div>

If(condition)(children)

  • condition: any javascript expression
  • children: react nodes to render

License

MIT

Install

npm i if.jsx

DownloadsWeekly Downloads

0

Version

1.0.0

License

MIT

Last publish

Collaborators

  • avatar