From 33e18d1ada6c0eb22e04eeb5bd9257fa7a735853 Mon Sep 17 00:00:00 2001 From: Damian Stasik Date: Sun, 26 Sep 2021 15:54:34 +0200 Subject: [PATCH] refactor: replace create-react-class with ES6 classes --- package.json | 1 - src/dashboard/AppData.react.js | 22 +++++++++++++--------- src/dashboard/Dashboard.js | 5 ++--- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/package.json b/package.json index f3d13c2d1d..b932c31b1d 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/dashboard/AppData.react.js b/src/dashboard/AppData.react.js index 997c292181..bd44686c86 100644 --- a/src/dashboard/AppData.react.js +++ b/src/dashboard/AppData.react.js @@ -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 === '_') { @@ -48,6 +47,11 @@ let AppData = createClass({ ); } -}); +} + +AppData.childContextTypes = { + generatePath: PropTypes.func, + currentApp: PropTypes.instanceOf(ParseApp) +}; export default AppData; diff --git a/src/dashboard/Dashboard.js b/src/dashboard/Dashboard.js index 0dfe25ce1a..5f7153a367 100644 --- a/src/dashboard/Dashboard.js +++ b/src/dashboard/Dashboard.js @@ -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
Not yet implemented
; } -}); +} const AccountSettingsPage = () => (