gpt4 book ai didi

javascript - jump-player-tab-container.js :129 Uncaught (in promise) ReferenceError: isActive is not defined(…)render @ jump-player-tab-container. js:129

转载 作者:太空宇宙 更新时间:2023-11-04 13:06:32 26 4
gpt4 key购买 nike

我是 js 的新手我正在尝试通过 Prop isActive .但我收到一个错误。你们能告诉我为什么我会收到下面的错误代码吗?我在这一行收到了错误 <AccountSetupTab sportsPhone={this.props.sportsPhone} isActiveSecond={isActive} />

import React from 'react';
import {connect} from 'react-redux';
import moment from 'moment';


import height from './jump-player-tab-content';
import weight from './jump-player-pane-content';
import AccountSetupTab from './running-setup';
import BalancePortfolio from './balance-portfolio';


class FirstTimeTab extends React.Component {

constructor(props) {
super(props);

this.state = {
runningSetup: 'jump-player-active',
investmentPurchase: 'sports-invest-ico',
balancePortfolio: 'sports-balance-ico',
performance: 'sports-perf-ico',
selectedTab: 0
};
}


componentWillMount() {

let {sportsPhone, runningSnapshot, runningPositions, runningPerformance} = this.props;
let managedProductActivationDate = this.props.sportsPhone.managedProductActivationDate;
let past1Day = moment().subtract(1, 'days').format('YYYY-MM-DD');
let isActive= managedProductActivationDate < past1Day;

if(sportsPhone !== '' && !isActive) {
this.setState({
selectedTab: 0,
runningSetup: "sports-setup-ico jump-player-active ft-active-tab"
});
}else if(isActive) {
this.setState({
selectedTab: 1,
runningSetup: "sports-setup-ico ft-prev-day",
investmentPurchase: "sports-invest-ico jump-player-active ft-active-tab"
});
}else if(runningSnapshot !== undefined && runningPositions.positions.length > 0 ) {
this.setState({
selectedTab: 2,
runningSetup: "ft-prev-day",
investmentPurchase: "ft-prev-day",
balancePortfolio: "sports-balance-ico jump-player-active ft-active-tab"
});
}else if(runningPerformance !== undefined ) {
this.setState({
selectedTab: 3,
runningSetup: "dft-prev-day",
investmentPurchase: "ft-prev-day",
balancePortfolio: "ft-prev-day",
performance: "sports-perf-ico jump-player-active ft-active-tab"
});
}
}

callback(selectedTab){
if (this.state.selectedTab !== selectedTab) {
switch(this.state.selected) {
case 0:
let temp = this.state.runningSetup.substring(32, 45);
this.setState({runningSetup: temp});
break;
case 1:
let temp1 = this.state.runningSetup.substring(33, 46);
this.setState({runningSetup: temp});
break;
case 2:
let tem2 = this.state.runningSetup.substring(34, 47);
this.setState({runningSetup: temp});
break;
case 3:
let temp3 = this.state.runningSetup.substring(31, 41);
this.setState({runningSetup: temp});
break;

}
switch(selected) {
/*case 0:
let temp = this.state.runningSetup+' ft-active-tab';
this.setState({runningSetup: temp});
break;*/
case 0:
let temp4 = this.state.runningSetup.substring(0, 32);
this.setState({runningSetup: temp});
break;
case 1:
let temp5 = this.state.runningSetup.substring(0, 33);
this.setState({runningSetup: temp});
break;
case 2:
let temp6 = this.state.runningSetup.substring(0, 34);
this.setState({runningSetup: temp});
break;
case 3:
let temp7 = this.state.runningSetup.substring(0, 31);
this.setState({runningSetup: temp});
break;
}
}
}

render () {


// service changes need to be done


let isActiveSecond= managedProductActivationDate < past1Day;
// let {sportsPhone, runningSnapshot, runningPositions, runningPerformance} = this.props;
let managedProductActivationDate = this.props.sportsPhone.managedProductActivationDate;
let past1Day = moment().subtract(1, 'days').format('YYYY-MM-DD');
// let isActive= managedProductActivationDate < past1Day;

//let selectedTab = 0;



return (
<height selected={ this.state.selectedTab}>
<weight label="Account Setup" subtitle="Days 1 and 2" liClass={ this.state.runningSetup}>
<div>
<AccountSetupTab sportsPhone={this.props.sportsPhone} isActiveSecond={isActive} />
</div>
</weight>
<weight label="Investments Purchase" subtitle="Approx. Day 3" liClass={this.state.investmentPurchase}>
<div className="sports-tab-content">
<p className="sports-large-text ft-day1 ft-day2">
Once we verify your deposit and your running has been funded, we’ll start purchasing ETFs for your portfolio.
</p>
</div>
</weight>
<weight label="Balance and Portfolio" subtitle="Approx. Day 4" liClass={this.state.balancePortfolio}>
<div >
<BalancePortfolio portfolio={this.props.portfolio} />
</div>
</weight>
<weight label="Performance" subtitle="Approx. Day 5" liClass={this.state.performance}>
<div className="sports-tab-content">
<p className="sports-large-text ft-day1 ft-day2 ft-day3 ft-day4">
You’ll be able to monitor your portfolio as it responds to daily market changes.
</p>
</div>
</weight>
</height>
);
}
}

FirstTimeTab.propTypes = {
sportsPhone: React.PropTypes.object.isRequired,
runningSnapshot: React.PropTypes.object.isRequired,
runningPositions: React.PropTypes.object.isRequired,
runningPerformance: React.PropTypes.object.isRequired,
portfolio: React.PropTypes.object.isRequired,
managedProductActivationDate: React.PropTypes.object.isRequired
};

function select(state) {
return {
sportsPhone: state.sportsPhone,
runningSnapshot: React.PropTypes.object.isRequired,
runningPositions: React.PropTypes.object.isRequired,
runningPerformance: React.PropTypes.object.isRequired,
portfolio: state.portfolio,
past1Day: React.PropTypes.number,
isActive: React.PropTypes.object.isRequired
};
}

export default connect(select)(FirstTimeTab);

最佳答案

您需要将 isActive 指定为 prop,因为它通过 connect 函数作为 prop 提供给 React 组件。这就是它给你一个 undefined error 的原因。我希望这能解决你的问题

<AccountSetupTab sportsPhone={this.props.sportsPhone} isActiveSecond={this.props.isActive} />

关于javascript - jump-player-tab-container.js :129 Uncaught (in promise) ReferenceError: isActive is not defined(…)render @ jump-player-tab-container. js:129,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40778693/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com