javascript - Unexpected Identifier while coding in React -


i making 'markdown previewer' using reactjs. however, stuck @ code seems me fine. error of 'unexpected identifier ='. can't seem wrap head around why displays error.

following code snippet ..

class markdown extends react.component {     static defaultprops = {         text : 'this comes defaultprops !'     };      static proptypes = {         text : react.proptypes.string.isrequired,         onchange : react.proptypes.func.isrequired;     };      constructor(props) {         super(props);         this.handlechange = this.handlechange.bind(this);     }      handlechange(e) {         this.props.onchange(e.target.value);     }      render() {         const style = {             width : '100%',             fontsize : '18px',             border : '1px solid grey',             padding : '20px'         };          return (             <textarea style={style} rows='20' placeholder='// enter text here ..' onchange='this.handlechange'>                 {this.props.text}             </textarea>         );     } } 

here project code link .. https://codepen.io/iamrkcheers/pen/oeeyvo

the error occurs @ line 67.

any appreciated. thank you.

my solution this, referring react documentation regarding type checking , creating defaultprops static function, them @ everytime.

class markdown extends react.component {      static defaultprops() {          return {             text : 'this comes defaultprops !'         };     }       constructor(props) {         super(props);         this.handlechange = this.handlechange.bind(this);     }      handlechange(e) {         this.props.onchange(e.target.value);     }      render() {         const style = {             width : '100%',             fontsize : '18px',             border : '1px solid grey',             padding : '20px'         };          return (             <textarea style={style} rows='20' placeholder='// enter text here ..' onchange='this.handlechange'>                 {this.props.text}             </textarea>         );     } }  markdown.proptypes = {         text : react.proptypes.string.isrequired,         onchange : react.proptypes.func.isrequired }; 

Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -