Skip to content

Commit

Permalink
refactor: replace create-react-class with ES6 classes
Browse files Browse the repository at this point in the history
  • Loading branch information
visualfanatic committed Sep 26, 2021
1 parent d9960de commit 33e18d1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
"connect-flash": "0.1.1",
"cookie-session": "2.0.0-beta.3",
"copy-to-clipboard": "3.2.0",
"create-react-class": "15.7.0",
"csurf": "1.11.0",
"express": "4.17.1",
"graphql": "14.6.0",
Expand Down
22 changes: 13 additions & 9 deletions src/dashboard/AppData.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,23 @@ import AppSelector from 'dashboard/AppSelector.react';
import AppsManager from 'lib/AppsManager';
import history from 'dashboard/history';
import ParseApp from 'lib/ParseApp';
import createClass from 'create-react-class';

let AppData = createClass({
childContextTypes: {
generatePath: PropTypes.func,
currentApp: PropTypes.instanceOf(ParseApp)
},
class AppData extends React.Component {
constructor(props) {
super(props);
this.generatePath = this.generatePath.bind(this);
}

getChildContext() {
return {
generatePath: this.generatePath,
currentApp: AppsManager.findAppBySlugOrName(this.props.params.appId)
};
},
}

generatePath(path) {
return '/apps/' + this.props.params.appId + '/' + path;
},
}

render() {
if (this.props.params.appId === '_') {
Expand All @@ -48,6 +47,11 @@ let AppData = createClass({
</div>
);
}
});
}

AppData.childContextTypes = {
generatePath: PropTypes.func,
currentApp: PropTypes.instanceOf(ParseApp)
};

export default AppData;
5 changes: 2 additions & 3 deletions src/dashboard/Dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,16 @@ import {
Switch,
} from 'react-router';
import { Route, Redirect } from 'react-router-dom';
import createClass from 'create-react-class';
import { Helmet } from 'react-helmet';
import Playground from './Data/Playground/Playground.react';

const ShowSchemaOverview = false; //In progress features. Change false to true to work on this feature.

let Empty = createClass({
class Empty extends React.Component {
render() {
return <div>Not yet implemented</div>;
}
});
}

const AccountSettingsPage = () => (
<AccountView section='Account Settings'>
Expand Down

0 comments on commit 33e18d1

Please sign in to comment.