@@ -36,12 +36,12 @@ var CommentBox = React.createClass({
3636 $ . ajax ( {
3737 url : this . props . url ,
3838 dataType : 'json' ,
39- success : function ( data ) {
39+ success : data => {
4040 this . setState ( { data : data } ) ;
41- } . bind ( this ) ,
42- error : function ( xhr , status , err ) {
41+ } ,
42+ error : ( xhr , status , err ) => {
4343 console . error ( this . props . url , status , err . toString ( ) ) ;
44- } . bind ( this )
44+ }
4545 } ) ;
4646 } ,
4747 emptyFormData : { author : "" , text : "" } ,
@@ -56,15 +56,15 @@ var CommentBox = React.createClass({
5656 dataType : 'json' ,
5757 type : 'POST' ,
5858 data : { comment : comment } ,
59- success : function ( data ) {
59+ success : data => {
6060 var comments = this . state . data ;
6161 var newComments = React . addons . update ( comments , { $push : [ comment ] } ) ;
6262 this . setState ( { ajaxSending : false , data : newComments , formData : this . emptyFormData } ) ;
63- } . bind ( this ) ,
64- error : function ( xhr , status , err ) {
63+ } ,
64+ error : ( xhr , status , err ) => {
6565 console . error ( this . props . url , status , err . toString ( ) ) ;
6666 this . setState ( { ajaxSending : false } ) ;
67- } . bind ( this )
67+ }
6868 } ) ;
6969 } ,
7070 getInitialState : function ( ) {
@@ -98,7 +98,7 @@ var CommentBox = React.createClass({
9898var CommentList = React . createClass ( {
9999 render : function ( ) {
100100 var reversedData = this . props . data . slice ( 0 ) . reverse ( ) ;
101- var commentNodes = reversedData . map ( function ( comment , index ) {
101+ var commentNodes = reversedData . map ( ( comment , index ) => {
102102 return (
103103 // `key` is a React-specific concept and is not mandatory for the
104104 // purpose of this tutorial. if you're curious, see more here:
@@ -119,9 +119,10 @@ var CommentList = React.createClass({
119119var CommentForm = React . createClass ( {
120120 getInitialState : function ( ) {
121121 return {
122- formMode : 0 ,
122+ formMode : 0
123123 } ;
124- } , handleSubmit : function ( e ) {
124+ } ,
125+ handleSubmit : function ( e ) {
125126 e . preventDefault ( ) ;
126127 this . props . onCommentSubmit ( ) ;
127128 return ;
0 commit comments