Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

How do I conditionally add attributes to React components?

var InputComponent = React.createClass({
    render: function() {
        var required = true;
        var disabled = false;

        return (
            <input type="text" disabled={disabled} required={required} />
        );
    }
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #How #I #conditionally #add #attributes #React
ADD COMMENT
Topic
Name
7+8 =