commit b0521734653c0f8e4bba75163f420b4457786b83
parent 0a80a31b1c8b5ee33c9eef307db0147e27056d1d
Author: Rodolfo Sanchez <rodolfo2488@gmial.com>
Date: Fri, 11 Sep 2015 08:52:47 -0500
Update Components to extend React.Component
New version of React warn you if you does not extend from this
component.
Diffstat:
15 files changed, 31 insertions(+), 30 deletions(-)
diff --git a/src/components/App/App.js b/src/components/App/App.js
@@ -1,6 +1,6 @@
/*! React Starter Kit | MIT License | http://www.reactstarterkit.com/ */
-import React, { PropTypes } from 'react';
+import React, { PropTypes, Component } from 'react';
import styles from './App.css';
import withContext from '../../decorators/withContext';
import withStyles from '../../decorators/withStyles';
@@ -10,7 +10,7 @@ import Footer from '../Footer';
@withContext
@withStyles(styles)
-class App {
+class App extends Component {
static propTypes = {
children: PropTypes.element.isRequired,
diff --git a/src/components/ContactPage/ContactPage.js b/src/components/ContactPage/ContactPage.js
@@ -1,11 +1,11 @@
/*! React Starter Kit | MIT License | http://www.reactstarterkit.com/ */
-import React, { PropTypes } from 'react';
+import React, { PropTypes, Component } from 'react';
import styles from './ContactPage.css';
import withStyles from '../../decorators/withStyles';
@withStyles(styles)
-class ContactPage {
+class ContactPage extends Component {
static contextTypes = {
onSetTitle: PropTypes.func.isRequired
diff --git a/src/components/ContentPage/ContentPage.js b/src/components/ContentPage/ContentPage.js
@@ -1,11 +1,11 @@
/*! React Starter Kit | MIT License | http://www.reactstarterkit.com/ */
-import React, { PropTypes } from 'react';
+import React, { PropTypes, Component } from 'react';
import styles from './ContentPage.css';
import withStyles from '../../decorators/withStyles';
@withStyles(styles)
-class ContentPage {
+class ContentPage extends Component {
static propTypes = {
path: PropTypes.string.isRequired,
diff --git a/src/components/ErrorPage/ErrorPage.js b/src/components/ErrorPage/ErrorPage.js
@@ -1,11 +1,11 @@
/*! React Starter Kit | MIT License | http://www.reactstarterkit.com/ */
-import React, { PropTypes } from 'react';
+import React, { PropTypes, Component } from 'react';
import withStyles from '../../decorators/withStyles';
import styles from './ErrorPage.css';
@withStyles(styles)
-class ErrorPage {
+class ErrorPage extends Component {
static contextTypes = {
onSetTitle: PropTypes.func.isRequired,
diff --git a/src/components/Feedback/Feedback.js b/src/components/Feedback/Feedback.js
@@ -1,11 +1,11 @@
/*! React Starter Kit | MIT License | http://www.reactstarterkit.com/ */
-import React from 'react';
+import React, { Component } from 'react';
import styles from './Feedback.css';
import withStyles from '../../decorators/withStyles';
@withStyles(styles)
-class Feedback {
+class Feedback extends Component {
render() {
return (
diff --git a/src/components/Footer/Footer.js b/src/components/Footer/Footer.js
@@ -1,6 +1,6 @@
/*! React Starter Kit | MIT License | http://www.reactstarterkit.com/ */
-import React, { PropTypes } from 'react';
+import React, { PropTypes, Component } from 'react';
import styles from './Footer.css';
import withViewport from '../../decorators/withViewport';
import withStyles from '../../decorators/withStyles';
@@ -8,7 +8,7 @@ import Link from '../Link';
@withViewport
@withStyles(styles)
-class Footer {
+class Footer extends Component {
static propTypes = {
viewport: PropTypes.shape({
diff --git a/src/components/Header/Header.js b/src/components/Header/Header.js
@@ -1,13 +1,13 @@
/*! React Starter Kit | MIT License | http://www.reactstarterkit.com/ */
-import React from 'react';
+import React, { Component } from 'react';
import styles from './Header.css';
import withStyles from '../../decorators/withStyles';
import Link from '../Link';
import Navigation from '../Navigation';
@withStyles(styles)
-class Header {
+class Header extends Component {
render() {
return (
diff --git a/src/components/Link/Link.js b/src/components/Link/Link.js
@@ -1,6 +1,6 @@
/*! React Starter Kit | MIT License | http://www.reactstarterkit.com/ */
-import React, { PropTypes } from 'react';
+import React, { PropTypes, Component } from 'react';
import Location from '../../core/Location';
function isLeftClickEvent(event) {
@@ -11,7 +11,7 @@ function isModifiedEvent(event) {
return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);
}
-class Link {
+class Link extends Component {
static propTypes = {
to: PropTypes.string.isRequired,
diff --git a/src/components/LoginPage/LoginPage.js b/src/components/LoginPage/LoginPage.js
@@ -1,11 +1,11 @@
/*! React Starter Kit | MIT License | http://www.reactstarterkit.com/ */
-import React, { PropTypes } from 'react';
+import React, { PropTypes, Component } from 'react';
import styles from './LoginPage.css';
import withStyles from '../../decorators/withStyles';
@withStyles(styles)
-class LoginPage {
+class LoginPage extends Component {
static contextTypes = {
onSetTitle: PropTypes.func.isRequired
diff --git a/src/components/Navigation/Navigation.js b/src/components/Navigation/Navigation.js
@@ -1,13 +1,13 @@
/*! React Starter Kit | MIT License | http://www.reactstarterkit.com/ */
-import React, { PropTypes } from 'react';
+import React, { PropTypes, Component } from 'react';
import classNames from 'classnames';
import styles from './Navigation.css';
import withStyles from '../../decorators/withStyles';
import Link from '../Link';
@withStyles(styles)
-class Navigation {
+class Navigation extends Component {
static propTypes = {
className: PropTypes.string
diff --git a/src/components/NotFoundPage/NotFoundPage.js b/src/components/NotFoundPage/NotFoundPage.js
@@ -1,11 +1,11 @@
/*! React Starter Kit | MIT License | http://www.reactstarterkit.com/ */
-import React, { PropTypes } from 'react';
+import React, { PropTypes, Component } from 'react';
import withStyles from '../../decorators/withStyles';
import styles from './NotFoundPage.css';
@withStyles(styles)
-class NotFoundPage {
+class NotFoundPage extends Component {
static contextTypes = {
onSetTitle: PropTypes.func.isRequired,
diff --git a/src/components/RegisterPage/RegisterPage.js b/src/components/RegisterPage/RegisterPage.js
@@ -1,11 +1,11 @@
/*! React Starter Kit | MIT License | http://www.reactstarterkit.com/ */
-import React, { PropTypes } from 'react';
+import React, { PropTypes, Component } from 'react';
import withStyles from '../../decorators/withStyles';
import styles from './RegisterPage.css';
@withStyles(styles)
-class RegisterPage {
+class RegisterPage extends Component {
static contextTypes = {
onSetTitle: PropTypes.func.isRequired
diff --git a/src/components/TextBox/TextBox.js b/src/components/TextBox/TextBox.js
@@ -1,11 +1,11 @@
/*! React Starter Kit | MIT License | http://www.reactstarterkit.com/ */
-import React, { PropTypes } from 'react';
+import React, { PropTypes, Component } from 'react';
import withStyles from '../../decorators/withStyles';
import styles from './TextBox.css';
@withStyles(styles)
-class TextBox {
+class TextBox extends Component {
static propTypes = {
maxLines: PropTypes.number
diff --git a/src/decorators/withContext.js b/src/decorators/withContext.js
@@ -1,10 +1,10 @@
/*! React Starter Kit | MIT License | http://www.reactstarterkit.com/ */
-import React, { PropTypes } from 'react'; // eslint-disable-line no-unused-vars
+import React, { PropTypes, Component } from 'react'; // eslint-disable-line no-unused-vars
import emptyFunction from 'fbjs/lib/emptyFunction';
function withContext(ComposedComponent) {
- return class WithContext {
+ return class WithContext extends Component {
static propTypes = {
context: PropTypes.shape({
diff --git a/src/decorators/withStyles.js b/src/decorators/withStyles.js
@@ -1,19 +1,20 @@
/*! React Starter Kit | MIT License | http://www.reactstarterkit.com/ */
-import React, { PropTypes } from 'react'; // eslint-disable-line no-unused-vars
+import React, { PropTypes, Component } from 'react'; // eslint-disable-line no-unused-vars
import invariant from 'fbjs/lib/invariant';
import { canUseDOM } from 'fbjs/lib/ExecutionEnvironment';
let count = 0;
function withStyles(styles) {
- return (ComposedComponent) => class WithStyles {
+ return (ComposedComponent) => class WithStyles extends Component {
static contextTypes = {
onInsertCss: PropTypes.func
};
constructor() {
+ super();
this.refCount = 0;
ComposedComponent.prototype.renderCss = function (css) {
let style;