React-conditional-component
This component displays its children only if they satisfy their predicate:
The value is 10 or "10" The value is 10 The value is lower than or equal to 10 ...
Install
bower install react-conditional-componentornpm install react-conditional-component
Simply require it to use it:
var Conditional = ;
Example
/*** @jsx React.DOM*/var Demo = React.createClass({ getInitialState: function() { return {someValue: 10}; }, componentDidMount: function() { // Change the value after 1 second setTimeout(function() { this.setState({value: 0}); }.bind(this), 1000); }, render: function() { return ( The value is 10 or "10" The value is 10 The value is lower than or equal to 10 The value is true The value is truthy ); }}); React.renderComponent(, document.body);
Predicates
The available predicates are: showIfDefined
,showIfUndefined
,showIfTrue
,showIfTruthy
,showIfFalse
,showIfFalsy
,showIfEquals
,showIfStrictlyEquals
,showIfLte
,showIfLt
,showIfGte
,showIfGt
.
License
MIT.