Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Replace createClass with external react-create-class dependency
Warns when using React.createClass for the first time.

Usages of createClass in tests have been converted to plain JavaScript
classes. Tests that rely on replaceState or isMounted use
updater.enqueueReplaceState and updater.isMounted.
  • Loading branch information
acdlite committed Mar 21, 2017
1 parent 60a7955 commit d9a4fa4
Show file tree
Hide file tree
Showing 32 changed files with 628 additions and 3,732 deletions.
8 changes: 4 additions & 4 deletions mocks/ReactElementTestChild.js
Expand Up @@ -13,10 +13,10 @@

var React = require('React');

var Child = React.createClass({
render: function() {
class Child extends React.Component {
render() {
return React.createElement('div');
},
});
}
}

module.exports = Child;
21 changes: 8 additions & 13 deletions mocks/ReactMockedComponentTestComponent.js
Expand Up @@ -13,23 +13,18 @@

var React = require('React');

var ReactMockedComponentTestComponent = React.createClass({
getDefaultProps: function() {
return {bar: 'baz'};
},
class ReactMockedComponentTestComponent extends React.Component {
state = {foo: 'bar'};

getInitialState: function() {
return {foo: 'bar'};
},

hasCustomMethod: function() {
hasCustomMethod() {
return true;
},
}

render: function() {
render() {
return <span />;
},
}

});
}
ReactMockedComponentTestComponent.defaultProps = {bar: 'baz'};

module.exports = ReactMockedComponentTestComponent;
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -69,6 +69,7 @@
"merge-stream": "^1.0.0",
"object-assign": "^4.1.1",
"platform": "^1.1.0",
"react-create-class": "15.5.0-alpha.2",
"run-sequence": "^1.1.4",
"through2": "^2.0.0",
"tmp": "~0.0.28",
Expand Down
145 changes: 0 additions & 145 deletions src/addons/__tests__/ReactComponentWithPureRenderMixin-test.js

This file was deleted.

46 changes: 0 additions & 46 deletions src/addons/link/__tests__/LinkedStateMixin-test.js

This file was deleted.

0 comments on commit d9a4fa4

Please sign in to comment.