chore(react): PureComponent -> Component
This commit is contained in:
committed by
mrugesh mohapatra
parent
987da19254
commit
aca424be97
@ -1,4 +1,4 @@
|
|||||||
import React, { PureComponent } from 'react';
|
import React, { Component } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { bindActionCreators } from 'redux';
|
import { bindActionCreators } from 'redux';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
@ -40,7 +40,7 @@ const propTypes = {
|
|||||||
|
|
||||||
const stripeKey = 'pk_live_E6Z6xPM8pEsJziHW905zpAvF';
|
const stripeKey = 'pk_live_E6Z6xPM8pEsJziHW905zpAvF';
|
||||||
|
|
||||||
class DonationModal extends PureComponent {
|
class DonationModal extends Component {
|
||||||
constructor(...props) {
|
constructor(...props) {
|
||||||
super(...props);
|
super(...props);
|
||||||
this.state = {
|
this.state = {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import React, { PureComponent } from 'react';
|
import React, { Component } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { Button } from '@freecodecamp/react-bootstrap';
|
import { Button } from '@freecodecamp/react-bootstrap';
|
||||||
|
|
||||||
@ -9,7 +9,7 @@ const propTypes = {
|
|||||||
handleSubmit: PropTypes.func.isRequired
|
handleSubmit: PropTypes.func.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
class CardForm extends PureComponent {
|
class CardForm extends Component {
|
||||||
constructor(...props) {
|
constructor(...props) {
|
||||||
super(...props);
|
super(...props);
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import React, { PureComponent, Fragment } from 'react';
|
import React, { Component, Fragment } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import isEmail from 'validator/lib/isEmail';
|
import isEmail from 'validator/lib/isEmail';
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ const initialSate = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class DonateForm extends PureComponent {
|
class DonateForm extends Component {
|
||||||
constructor(...args) {
|
constructor(...args) {
|
||||||
super(...args);
|
super(...args);
|
||||||
const [props] = args;
|
const [props] = args;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import React, { PureComponent } from 'react';
|
import React, { Component } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import {
|
import {
|
||||||
CardNumberElement,
|
CardNumberElement,
|
||||||
@ -17,7 +17,7 @@ const style = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class StripCardForm extends PureComponent {
|
class StripCardForm extends Component {
|
||||||
constructor(...props) {
|
constructor(...props) {
|
||||||
super(...props);
|
super(...props);
|
||||||
|
|
||||||
|
@ -1,30 +1,37 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
|
import { createSelector } from 'reselect';
|
||||||
import { Button } from '@freecodecamp/react-bootstrap';
|
import { Button } from '@freecodecamp/react-bootstrap';
|
||||||
|
|
||||||
import { hardGoTo } from '../../../redux';
|
import { hardGoTo, isSignedInSelector } from '../../../redux';
|
||||||
import { apiLocation } from '../../../../config/env.json';
|
import { apiLocation } from '../../../../config/env.json';
|
||||||
|
|
||||||
import { gtagReportConversion } from '../../../analytics/gtag';
|
import { gtagReportConversion } from '../../../analytics/gtag';
|
||||||
|
|
||||||
import './login.css';
|
import './login.css';
|
||||||
|
|
||||||
const mapStateToProps = () => ({});
|
const mapStateToProps = createSelector(
|
||||||
|
isSignedInSelector,
|
||||||
|
({ isSingedIn }) => ({ isSingedIn })
|
||||||
|
);
|
||||||
const mapDispatchToProps = dispatch => ({
|
const mapDispatchToProps = dispatch => ({
|
||||||
navigate: location => dispatch(hardGoTo(location))
|
navigate: location => dispatch(hardGoTo(location))
|
||||||
});
|
});
|
||||||
|
|
||||||
const createOnClick = navigate => e => {
|
const createOnClick = (navigate, isSingedIn) => e => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
gtagReportConversion();
|
gtagReportConversion();
|
||||||
|
if (isSingedIn) {
|
||||||
|
return navigate('/welcome');
|
||||||
|
}
|
||||||
return navigate(`${apiLocation}/signin`);
|
return navigate(`${apiLocation}/signin`);
|
||||||
};
|
};
|
||||||
|
|
||||||
function Login(props) {
|
function Login(props) {
|
||||||
const { children, navigate, ...restProps } = props;
|
const { children, navigate, isSingedIn, ...restProps } = props;
|
||||||
return (
|
return (
|
||||||
<a href='/signin' onClick={createOnClick(navigate)}>
|
<a href='/signin' onClick={createOnClick(navigate, isSingedIn)}>
|
||||||
<Button
|
<Button
|
||||||
{...restProps}
|
{...restProps}
|
||||||
bsStyle='default'
|
bsStyle='default'
|
||||||
@ -41,6 +48,7 @@ function Login(props) {
|
|||||||
Login.displayName = 'Login';
|
Login.displayName = 'Login';
|
||||||
Login.propTypes = {
|
Login.propTypes = {
|
||||||
children: PropTypes.any,
|
children: PropTypes.any,
|
||||||
|
isSingedIn: PropTypes.bool,
|
||||||
navigate: PropTypes.func.isRequired
|
navigate: PropTypes.func.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import React, { PureComponent } from 'react';
|
import React, { Component } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import uniq from 'lodash/uniq';
|
import uniq from 'lodash/uniq';
|
||||||
|
|
||||||
@ -21,7 +21,7 @@ const propTypes = {
|
|||||||
nodes: PropTypes.arrayOf(ChallengeNode)
|
nodes: PropTypes.arrayOf(ChallengeNode)
|
||||||
};
|
};
|
||||||
|
|
||||||
class ShowMap extends PureComponent {
|
class ShowMap extends Component {
|
||||||
renderSuperBlocks(superBlocks) {
|
renderSuperBlocks(superBlocks) {
|
||||||
const { nodes, introNodes } = this.props;
|
const { nodes, introNodes } = this.props;
|
||||||
return superBlocks.map(superBlock => (
|
return superBlocks.map(superBlock => (
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import React, { PureComponent } from 'react';
|
import React, { Component } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { bindActionCreators } from 'redux';
|
import { bindActionCreators } from 'redux';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
@ -46,7 +46,7 @@ const propTypes = {
|
|||||||
|
|
||||||
const mapIconStyle = { height: '15px', marginRight: '10px', width: '15px' };
|
const mapIconStyle = { height: '15px', marginRight: '10px', width: '15px' };
|
||||||
|
|
||||||
export class Block extends PureComponent {
|
export class Block extends Component {
|
||||||
constructor(...props) {
|
constructor(...props) {
|
||||||
super(...props);
|
super(...props);
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import React, { PureComponent } from 'react';
|
import React, { Component } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { bindActionCreators } from 'redux';
|
import { bindActionCreators } from 'redux';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
@ -52,7 +52,7 @@ function createSuperBlockTitle(str) {
|
|||||||
: `${str} Certification (300 hours)`;
|
: `${str} Certification (300 hours)`;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class SuperBlock extends PureComponent {
|
export class SuperBlock extends Component {
|
||||||
renderBlock(superBlock) {
|
renderBlock(superBlock) {
|
||||||
const { nodes, introNodes } = this.props;
|
const { nodes, introNodes } = this.props;
|
||||||
const blocksForSuperBlock = nodes.filter(
|
const blocksForSuperBlock = nodes.filter(
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import React, { PureComponent, Fragment } from 'react';
|
import React, { Component, Fragment } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import nanoid from 'nanoid';
|
import nanoid from 'nanoid';
|
||||||
import {
|
import {
|
||||||
@ -51,7 +51,7 @@ const mockEvent = {
|
|||||||
preventDefault() {}
|
preventDefault() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class PortfolioSettings extends PureComponent {
|
class PortfolioSettings extends Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import React, { PureComponent, createContext } from 'react';
|
import React, { Component, createContext } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
|
|
||||||
const noop = () => {};
|
const noop = () => {};
|
||||||
@ -19,7 +19,7 @@ const propTypes = {
|
|||||||
children: PropTypes.any
|
children: PropTypes.any
|
||||||
};
|
};
|
||||||
|
|
||||||
class NavigationContextProvider extends PureComponent {
|
class NavigationContextProvider extends Component {
|
||||||
constructor(...props) {
|
constructor(...props) {
|
||||||
super(...props);
|
super(...props);
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import React, { PureComponent } from 'react';
|
import React, { Component } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { bindActionCreators } from 'redux';
|
import { bindActionCreators } from 'redux';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
@ -65,7 +65,7 @@ const defineMonacoThemes = monaco => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
class Editor extends PureComponent {
|
class Editor extends Component {
|
||||||
constructor(...props) {
|
constructor(...props) {
|
||||||
super(...props);
|
super(...props);
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import React, { PureComponent } from 'react';
|
import React, { Component } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import noop from 'lodash/noop';
|
import noop from 'lodash/noop';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
@ -59,7 +59,7 @@ const propTypes = {
|
|||||||
title: PropTypes.string
|
title: PropTypes.string
|
||||||
};
|
};
|
||||||
|
|
||||||
export class CompletionModal extends PureComponent {
|
export class CompletionModal extends Component {
|
||||||
render() {
|
render() {
|
||||||
const {
|
const {
|
||||||
close,
|
close,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import React, { PureComponent } from 'react';
|
import React, { Component } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { bindActionCreators } from 'redux';
|
import { bindActionCreators } from 'redux';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
@ -24,7 +24,7 @@ const RSA =
|
|||||||
'https://forum.freecodecamp.org/t/the-read-search-ask-methodology-for-' +
|
'https://forum.freecodecamp.org/t/the-read-search-ask-methodology-for-' +
|
||||||
'getting-unstuck/137307';
|
'getting-unstuck/137307';
|
||||||
|
|
||||||
export class HelpModal extends PureComponent {
|
export class HelpModal extends Component {
|
||||||
render() {
|
render() {
|
||||||
const { isOpen, closeHelpModal, createQuestion } = this.props;
|
const { isOpen, closeHelpModal, createQuestion } = this.props;
|
||||||
if (isOpen) {
|
if (isOpen) {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import React, { Fragment, PureComponent } from 'react';
|
import React, { Fragment, Component } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import MonacoEditor from 'react-monaco-editor';
|
import MonacoEditor from 'react-monaco-editor';
|
||||||
|
|
||||||
@ -24,7 +24,7 @@ const options = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class Output extends PureComponent {
|
class Output extends Component {
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import React, { PureComponent } from 'react';
|
import React, { Component } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
|
|
||||||
import './preview.css';
|
import './preview.css';
|
||||||
@ -10,7 +10,7 @@ const propTypes = {
|
|||||||
disableIframe: PropTypes.bool
|
disableIframe: PropTypes.bool
|
||||||
};
|
};
|
||||||
|
|
||||||
class Preview extends PureComponent {
|
class Preview extends Component {
|
||||||
constructor(...props) {
|
constructor(...props) {
|
||||||
super(...props);
|
super(...props);
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import React, { PureComponent } from 'react';
|
import React, { Component } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { bindActionCreators } from 'redux';
|
import { bindActionCreators } from 'redux';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
@ -19,7 +19,7 @@ const propTypes = {
|
|||||||
videoUrl: PropTypes.string
|
videoUrl: PropTypes.string
|
||||||
};
|
};
|
||||||
|
|
||||||
export class VideoModal extends PureComponent {
|
export class VideoModal extends Component {
|
||||||
render() {
|
render() {
|
||||||
const { isOpen, closeVideoModal, videoUrl } = this.props;
|
const { isOpen, closeVideoModal, videoUrl } = this.props;
|
||||||
if (isOpen) {
|
if (isOpen) {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import React, { PureComponent } from 'react';
|
import React, { Component } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@ -35,7 +35,7 @@ const options = {
|
|||||||
required: ['solution', 'githubLink']
|
required: ['solution', 'githubLink']
|
||||||
};
|
};
|
||||||
|
|
||||||
export class ProjectForm extends PureComponent {
|
export class ProjectForm extends Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import React, { PureComponent } from 'react';
|
import React, { Component } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { bindActionCreators } from 'redux';
|
import { bindActionCreators } from 'redux';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
@ -23,7 +23,7 @@ const propTypes = {
|
|||||||
openHelpModal: PropTypes.func.isRequired
|
openHelpModal: PropTypes.func.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
export class ToolPanel extends PureComponent {
|
export class ToolPanel extends Component {
|
||||||
render() {
|
render() {
|
||||||
const { guideUrl, openHelpModal } = this.props;
|
const { guideUrl, openHelpModal } = this.props;
|
||||||
return (
|
return (
|
||||||
|
Reference in New Issue
Block a user