Hello i am trying to render a component dynamically look:
render: function() {
return (
<form {...this.props}>
<div className={'row'}>
{this.props.fields.map(function(field, index){
if (index != 0 &&index%3==0) {
return (
</div><div className={'row'}>
<div className={'col-sm-4'}>
<div className={'row'}>
<div className={'col-sm-3'}>
<Label htmlFor={'filters_'+field.name}>{field.label}</Label>
</div>
<div className={'col-sm-9'}>
<InputText name={field.name} id={'filters_'+field.name} />
</div>
</div>
</div>
)
} else{
return (
<div className={'col-sm-4'}>
<div className={'row'}>
<div className={'col-sm-3'}>
<Label htmlFor={'filters_'+field.name}>{field.label}</Label>
</div>
<div className={'col-sm-9'}>
<InputText name={field.name} id={'filters_'+field.name} />
</div>
</div>
</div>
)
}
})}
</div>
</form>
);
}
but i am getting this error "Parse Error: Line 17: Unexpected token / while parsing file..."
the line 17 in my file is </div><div className={'row'}>
There is another way to do this? and is it possible to put all my duplicated code inside a variable?
Obs: i am using browserify(7.0.x) and reactfy(0.17.1)
Aucun commentaire:
Enregistrer un commentaire