1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Remove useless component constructors (#7718)

This commit is contained in:
Whymarrh Whitby 2019-12-19 18:30:22 -03:30 committed by GitHub
parent 4f79b924e4
commit 8701ac38a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 52 additions and 72 deletions

View File

@ -12,12 +12,8 @@ export default class InfoBox extends Component {
description: PropTypes.string,
}
constructor (props) {
super(props)
this.state = {
isShowing: true,
}
state = {
isShowing: true,
}
handleClose () {

View File

@ -2,17 +2,17 @@ import React, { Component } from 'react'
import PropTypes from 'prop-types'
export default class Tabs extends Component {
static defaultProps = {
defaultActiveTabIndex: 0,
}
static propTypes = {
defaultActiveTabIndex: PropTypes.number,
children: PropTypes.node,
}
constructor (props) {
super(props)
this.state = {
activeTabIndex: props.defaultActiveTabIndex || 0,
}
state = {
activeTabIndex: this.props.defaultActiveTabIndex,
}
handleTabClick (tabIndex) {

View File

@ -22,15 +22,12 @@ export default class UnitInput extends PureComponent {
}
static defaultProps = {
value: '',
placeholder: '0',
}
constructor (props) {
super(props)
this.state = {
value: props.value || '',
}
state = {
value: this.props.value,
}
componentDidUpdate (prevProps) {

View File

@ -9,19 +9,15 @@ export default function withTokenTracker (WrappedComponent) {
token: PropTypes.object.isRequired,
}
constructor (props) {
super(props)
this.state = {
string: '',
symbol: '',
balance: '',
error: null,
}
this.tracker = null
state = {
string: '',
symbol: '',
balance: '',
error: null,
}
tracker = null
componentDidMount () {
this.createFreshTokenTracker()
}

View File

@ -26,22 +26,18 @@ class AddToken extends Component {
identities: PropTypes.object,
}
constructor (props) {
super(props)
this.state = {
customAddress: '',
customSymbol: '',
customDecimals: 0,
searchResults: [],
selectedTokens: {},
tokenSelectorError: null,
customAddressError: null,
customSymbolError: null,
customDecimalsError: null,
autoFilled: false,
forceEditSymbol: false,
}
state = {
customAddress: '',
customSymbol: '',
customDecimals: 0,
searchResults: [],
selectedTokens: {},
tokenSelectorError: null,
customAddressError: null,
customSymbolError: null,
customDecimalsError: null,
autoFilled: false,
forceEditSymbol: false,
}
componentDidMount () {

View File

@ -9,16 +9,13 @@ const { DEFAULT_ROUTE } = require('../../../helpers/constants/routes')
const { formatBalance } = require('../../../helpers/utils/util')
class ConnectHardwareForm extends Component {
constructor (props) {
super(props)
this.state = {
error: null,
selectedAccount: null,
accounts: [],
browserSupported: true,
unlocked: false,
device: null,
}
state = {
error: null,
selectedAccount: null,
accounts: [],
browserSupported: true,
unlocked: false,
device: null,
}
UNSAFE_componentWillReceiveProps (nextProps) {

View File

@ -4,14 +4,15 @@ import { DEFAULT_ROUTE } from '../../helpers/constants/routes'
import Button from '../../components/ui/button'
export default class NewAccountCreateForm extends Component {
constructor (props, context) {
super(props)
const { newAccountNumber = 0 } = props
static defaultProps = {
newAccountNumber: 0,
}
this.state = {
newAccountName: '',
defaultAccountName: context.t('newAccountNumberName', [newAccountNumber]),
}
state = {
newAccountName: '',
defaultAccountName: this.context.t('newAccountNumberName', [
this.props.newAccountNumber,
]),
}
render () {

View File

@ -23,18 +23,15 @@ export default class UnlockPage extends Component {
showOptInModal: PropTypes.func,
}
constructor (props) {
super(props)
this.state = {
password: '',
error: null,
}
this.submitting = false
this.animationEventEmitter = new EventEmitter()
state = {
password: '',
error: null,
}
submitting = false
animationEventEmitter = new EventEmitter()
UNSAFE_componentWillMount () {
const { isUnlocked, history } = this.props