File tree Expand file tree Collapse file tree 10 files changed +44
-17
lines changed Expand file tree Collapse file tree 10 files changed +44
-17
lines changed Original file line number Diff line number Diff line change 1
1
import React , { PropTypes } from 'react' ;
2
- import pureRender from 'pure-render-decorator ' ;
2
+ import PureRenderMixin from 'react-addons- pure-render-mixin ' ;
3
3
4
4
import CommentForm from './CommentForm/CommentForm' ;
5
5
import CommentList from './CommentList/CommentList' ;
@@ -12,6 +12,10 @@ export default class CommentBox extends React.Component {
12
12
data : PropTypes . object . isRequired ,
13
13
} ;
14
14
15
+ shouldComponentUpdate ( ) {
16
+ return PureRenderMixin . shouldComponentUpdate . apply ( this , arguments ) ;
17
+ }
18
+
15
19
componentDidMount ( ) {
16
20
const { fetchComments } = this . props . actions ;
17
21
fetchComments ( ) ;
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ import NavItem from 'react-bootstrap/lib/NavItem';
8
8
import Alert from 'react-bootstrap/lib/Alert' ;
9
9
import ReactCSSTransitionGroup from 'react/lib/ReactCSSTransitionGroup' ;
10
10
import _ from 'lodash' ;
11
- import pureRender from 'pure-render-decorator ' ;
11
+ import PureRenderMixin from 'react-addons- pure-render-mixin ' ;
12
12
13
13
const emptyComment = { author : '' , text : '' } ;
14
14
const textPlaceholder = 'Say something using markdown...' ;
@@ -36,6 +36,10 @@ export default class CommentForm extends React.Component {
36
36
] ) ;
37
37
}
38
38
39
+ shouldComponentUpdate ( ) {
40
+ return PureRenderMixin . shouldComponentUpdate . apply ( this , arguments ) ;
41
+ }
42
+
39
43
_handleSelect ( selectedKey ) {
40
44
this . setState ( { formMode : selectedKey } ) ;
41
45
}
Original file line number Diff line number Diff line change 1
1
import React , { PropTypes } from 'react' ;
2
2
import marked from 'marked' ;
3
- import pureRender from 'pure-render-decorator ' ;
3
+ import PureRenderMixin from 'react-addons- pure-render-mixin ' ;
4
4
5
- < << << << HEAD :client / app / bundles / comments / components / CommentBox / CommentList / Comment / Comment . jsx
6
5
import css from './Comment.scss' ;
7
6
8
7
export default class Comment extends React . Component {
9
-
10
- === === =
11
- @pureRender
12
- class Comment extends React . Component {
13
- static displayName = 'Comment' ;
14
- >>> >>> > Including pure render decorator :client / app / bundles / Comments / components / Comment . jsx
15
8
static propTypes = {
16
9
author : PropTypes . string . isRequired ,
17
10
text : PropTypes . string . isRequired ,
18
11
} ;
19
12
13
+ shouldComponentUpdate ( ) {
14
+ return PureRenderMixin . shouldComponentUpdate . apply ( this , arguments ) ;
15
+ }
16
+
20
17
render ( ) {
21
18
const { author, text } = this . props ;
22
19
const rawMarkup = marked ( text , { gfm : true , sanitize : true } ) ;
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import Immutable from 'immutable';
3
3
import Alert from 'react-bootstrap/lib/Alert' ;
4
4
import ReactCSSTransitionGroup from 'react/lib/ReactCSSTransitionGroup' ;
5
5
import _ from 'lodash' ;
6
+ import PureRenderMixin from 'react-addons-pure-render-mixin' ;
6
7
7
8
import Comment from './Comment/Comment' ;
8
9
@@ -19,6 +20,10 @@ export default class CommentList extends React.Component {
19
20
_ . bindAll ( this , '_errorWarning' ) ;
20
21
}
21
22
23
+ shouldComponentUpdate ( ) {
24
+ return PureRenderMixin . shouldComponentUpdate . apply ( this , arguments ) ;
25
+ }
26
+
22
27
_errorWarning ( ) {
23
28
// If there is no error, there is nothing to add to the DOM
24
29
if ( ! this . props . error ) return null ;
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import React from 'react';
2
2
import Immutable from 'immutable' ;
3
3
import request from 'axios' ;
4
4
import _ from 'lodash' ;
5
+ import PureRenderMixin from 'react-addons-pure-render-mixin' ;
5
6
6
7
import metaTagsManager from 'libs/metaTagsManager' ;
7
8
import CommentForm from '../CommentBox/CommentForm/CommentForm' ;
@@ -20,6 +21,10 @@ export default class SimpleCommentScreen extends React.Component {
20
21
_ . bindAll ( this , '_fetchComments' , '_handleCommentSubmit' ) ;
21
22
}
22
23
24
+ shouldComponentUpdate ( ) {
25
+ return PureRenderMixin . shouldComponentUpdate . apply ( this , arguments ) ;
26
+ }
27
+
23
28
componentDidMount ( ) {
24
29
this . _fetchComments ( ) ;
25
30
}
Original file line number Diff line number Diff line change 1
1
import React from 'react' ;
2
- import pureRender from 'pure-render-decorator ' ;
2
+ import PureRenderMixin from 'react-addons- pure-render-mixin ' ;
3
3
4
- @pureRender
5
4
export default class TestReactRouter extends React . Component {
5
+ shouldComponentUpdate ( ) {
6
+ return PureRenderMixin . shouldComponentUpdate . apply ( this , arguments ) ;
7
+ }
6
8
7
9
render ( ) {
8
10
return (
Original file line number Diff line number Diff line change 1
1
import React from 'react' ;
2
- import pureRender from 'pure-render-decorator ' ;
2
+ import PureRenderMixin from 'react-addons- pure-render-mixin ' ;
3
3
4
- @pureRender
5
4
export default class TestReactRouterRedirect extends React . Component {
5
+ shouldComponentUpdate ( ) {
6
+ return PureRenderMixin . shouldComponentUpdate . apply ( this , arguments ) ;
7
+ }
6
8
7
9
static checkAuth ( nextState , replaceState ) {
8
10
// Hard code this to demonstrate the effect
Original file line number Diff line number Diff line change 1
1
import React , { PropTypes } from 'react' ;
2
2
import { connect } from 'react-redux' ;
3
3
import { bindActionCreators } from 'redux' ;
4
- import pureRender from 'pure-render-decorator ' ;
4
+ import PureRenderMixin from 'react-addons- pure-render-mixin ' ;
5
5
6
6
import CommentScreen from '../components/CommentScreen/CommentScreen' ;
7
7
import * as commentsActionCreators from '../actions/commentsActionCreators' ;
@@ -17,6 +17,10 @@ class NonRouterCommentsContainer extends React.Component {
17
17
data : PropTypes . object . isRequired ,
18
18
} ;
19
19
20
+ shouldComponentUpdate ( ) {
21
+ return PureRenderMixin . shouldComponentUpdate . apply ( this , arguments ) ;
22
+ }
23
+
20
24
render ( ) {
21
25
const { dispatch, data } = this . props ;
22
26
const actions = bindActionCreators ( commentsActionCreators , dispatch ) ;
Original file line number Diff line number Diff line change 1
1
import React , { PropTypes } from 'react' ;
2
2
import { connect } from 'react-redux' ;
3
3
import { bindActionCreators } from 'redux' ;
4
- import pureRender from 'pure-render-decorator ' ;
4
+ import PureRenderMixin from 'react-addons- pure-render-mixin ' ;
5
5
6
6
import CommentScreen from '../components/CommentScreen/CommentScreen' ;
7
7
import * as commentsActionCreators from '../actions/commentsActionCreators' ;
@@ -20,6 +20,10 @@ class RouterCommentsContainer extends React.Component {
20
20
} ) . isRequired ,
21
21
} ;
22
22
23
+ shouldComponentUpdate ( ) {
24
+ return PureRenderMixin . shouldComponentUpdate . apply ( this , arguments ) ;
25
+ }
26
+
23
27
render ( ) {
24
28
const { dispatch, data } = this . props ;
25
29
const actions = bindActionCreators ( commentsActionCreators , dispatch ) ;
Original file line number Diff line number Diff line change 67
67
"node-uuid" : " ^1.4.7" ,
68
68
"postcss-loader" : " ^0.8.0" ,
69
69
"react" : " ^0.14.3" ,
70
- "react-addons-shallow-compare " : " ^0.14.3" ,
70
+ "react-addons-pure-render-mixin " : " ^0.14.3" ,
71
71
"react-bootstrap" : " ^0.28.1" ,
72
72
"react-dom" : " ^0.14.3" ,
73
73
"react-redux" : " ^4.0.0" ,
You can’t perform that action at this time.
0 commit comments