|
|
|
|
|
by jaredgrippe
4245 days ago
|
|
One of my favorite patterns in React is using functions to wrap a React component. It goes something like this: App.Button = React.createClass({
render: function(){
var className = 'btn '+this.props.className
<a href className={className}>{this.props.children}</a>
}
});
App.BigButton = function(props){
props = props || {};
props.className = 'btn-large '+props.className
return App.Button.apply(null, arguments)
};
How would you do something like this? |
|
The idea of a lightweight declaration of a component (e.g. a just function) is definitely still on the table and might be resurrected in a different form.
https://github.com/reactjs/react-future/blob/master/01%20-%2...