zalando/zappr

View on GitHub
client/components/Optional.jsx

Summary

Maintainability
A
0 mins
Test Coverage
import React, { Component, PropTypes } from 'react'

export default class Optional extends Component {
  static propTypes = {
    if: PropTypes.bool.isRequired,
    children: PropTypes.node.isRequired
  };

  render() {
    if (this.props.if) {
      return this.props.children
    } else {
      return null
    }
  }
}