Skip to content

Commit

Permalink
Use create-react-class to avoid React.createClass deprecations
Browse files Browse the repository at this point in the history
fixes #367
  • Loading branch information
claydiffrient committed Apr 13, 2017
1 parent 16efd72 commit 86987d5
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 15 deletions.
3 changes: 2 additions & 1 deletion lib/components/Modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ var refCount = require('../helpers/refCount');
var elementClass = require('element-class');
var renderSubtreeIntoContainer = require("react-dom").unstable_renderSubtreeIntoContainer;
var Assign = require('lodash.assign');
var createReactClass = require('create-react-class')

var SafeHTMLElement = ExecutionEnvironment.canUseDOM ? window.HTMLElement : {};
var AppElement = ExecutionEnvironment.canUseDOM ? document.body : {appendChild: function() {}};
Expand All @@ -16,7 +17,7 @@ function getParentElement(parentSelector) {
return parentSelector();
}

var Modal = React.createClass({
var Modal = createReactClass({

displayName: 'Modal',
statics: {
Expand Down
3 changes: 2 additions & 1 deletion lib/components/ModalPortal.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ var div = React.DOM.div;
var focusManager = require('../helpers/focusManager');
var scopeTab = require('../helpers/scopeTab');
var Assign = require('lodash.assign');
var createReactClass = require('create-react-class');

// so that our CSS is statically analyzable
var CLASS_NAMES = {
Expand All @@ -18,7 +19,7 @@ var CLASS_NAMES = {
}
};

var ModalPortal = module.exports = React.createClass({
var ModalPortal = module.exports = createReactClass({

displayName: 'ModalPortal',
shouldClose: null,
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"webpack-dev-server": "1.11.0"
},
"dependencies": {
"create-react-class": "^15.5.2",
"element-class": "^0.2.0",
"exenv": "1.2.0",
"lodash.assign": "^4.2.0",
Expand Down
25 changes: 12 additions & 13 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1087,6 +1087,13 @@ core-util-is@~1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"

create-react-class@^15.5.2:
version "15.5.2"
resolved "https://registry.yarnpkg.com/create-react-class/-/create-react-class-15.5.2.tgz#6a8758348df660b88326a0e764d569f274aad681"
dependencies:
fbjs "^0.8.9"
object-assign "^4.1.1"

cross-spawn@^4.0.0:
version "4.0.2"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-4.0.2.tgz#7b9247621c23adfdd3856004a823cbe397424d41"
Expand Down Expand Up @@ -1563,19 +1570,7 @@ [email protected]:
version "0.1.8"
resolved "https://registry.yarnpkg.com/eyes/-/eyes-0.1.8.tgz#62cf120234c683785d902348a800ef3e0cc20bc0"

fbjs@^0.8.1, fbjs@^0.8.4:
version "0.8.8"
resolved "https://registry.yarnpkg.com/fbjs/-/fbjs-0.8.8.tgz#02f1b6e0ea0d46c24e0b51a2d24df069563a5ad6"
dependencies:
core-js "^1.0.0"
isomorphic-fetch "^2.1.1"
loose-envify "^1.0.0"
object-assign "^4.1.0"
promise "^7.1.1"
setimmediate "^1.0.5"
ua-parser-js "^0.7.9"

fbjs@^0.8.9:
fbjs@^0.8.1, fbjs@^0.8.4, fbjs@^0.8.9:
version "0.8.12"
resolved "https://registry.yarnpkg.com/fbjs/-/fbjs-0.8.12.tgz#10b5d92f76d45575fd63a217d4ea02bea2f8ed04"
dependencies:
Expand Down Expand Up @@ -3202,6 +3197,10 @@ object-assign@^4.0.1, object-assign@^4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.0.tgz#7a3b3d0e98063d43f4c03f2e8ae6cd51a86883a0"

object-assign@^4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863"

[email protected]:
version "0.0.3"
resolved "https://registry.yarnpkg.com/object-component/-/object-component-0.0.3.tgz#f0c69aa50efc95b866c186f400a33769cb2f1291"
Expand Down

3 comments on commit 86987d5

@syabro
Copy link

@syabro syabro commented on 86987d5 Apr 15, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@claydiffrient what the point of using create-react-class?
Why not to refactor to ES6 classes and extend?

@claydiffrient
Copy link
Contributor Author

@claydiffrient claydiffrient commented on 86987d5 Apr 15, 2017 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@syabro
Copy link

@syabro syabro commented on 86987d5 Apr 15, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@claydiffrient got it, thanks

Please sign in to comment.