javascript - What's wrong with this treatment of ReactJS properties? -
in code react.createclass() class, have getdefaultprops() method returns dictionary initial_text set text value.
getdefaultprops: function() { return { initial_text: "**i *terribly* " + ...
then, in render(), try access this.props.initial_text:
render: function() { var tokenize = function(original) { var workbench = original; var result = []; while (workbench) { if (workbench[0] === '<') { length = workbench.indexof('>'); if (length > -1) { length = 1; } } else { length = 1; } result.push(workbench.substr(0, length)); workbench = workbench.substr(length); } return result; } var initial_tokens = tokenize(converter.makehtml( this.props.initial_text));
chrome's console shows:
uncaught referenceerror: initial_text not defined
what need set string in default properties, , accessing code, string back?
Comments
Post a Comment