Skip to content

Commit

Permalink
fix: no state needed for Hogan component
Browse files Browse the repository at this point in the history
  • Loading branch information
vvo committed Aug 1, 2015
1 parent ea666ad commit d8a3a4c
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions components/templates/Hogan/index.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
'use strict';

var React = require('react');

var hogan = require('hogan.js');
var React = require('react');

var HoganResult = React.createClass({
propTypes: {
template: React.PropTypes.string,
data: React.PropTypes.object
},
componentWillMount: function() {
this.setState({
template: hogan.compile(this.props.template)
});
},
render: function() {
var content = this.state.template.render(this.props.data);
var content = hogan.compile(this.props.template).render(this.props.data);
return <div className="hit" dangerouslySetInnerHTML={{__html: content}} />;
}
});
Expand Down

0 comments on commit d8a3a4c

Please sign in to comment.