-
Notifications
You must be signed in to change notification settings - Fork 101
Closed
Description
Hi,
Great job on react-magic. I'm trying to use this component with the following option:
{
createClass: true
}
I would expect the following output:
"React.createClass..."
but it turns out to be
"var NewComponent = React.createClass...."
I see in the code that the config outputClassName is optional. In the convert function we have:
if (this.config.createClass) {
if (this.config.outputClassName) {
this.output = 'var ' + this.config.outputClassName + ' = React.createClass({\n';
} else { // this is the callback i was expecting to be called
this.output = 'React.createClass({\n';
}
this.output += this.config.indent + 'render: function() {' + "\n";
this.output += this.config.indent + this.config.indent + 'return (\n';
}
But in the object constructor there is always a fallback to 'NewComponent', from the source-code:
var HTMLtoJSX = function(config) {
this.config = config || {};
if (this.config.createClass === undefined) {
this.config.createClass = true;
}
if (!this.config.indent) {
this.config.indent = ' ';
}
if (!this.config.outputClassName) { // I would not expect to have this line in place.
this.config.outputClassName = 'NewComponent';
}
};
Metadata
Metadata
Assignees
Labels
No labels