user7134252
user7134252

Reputation:

Module build failed: SyntaxError: Unexpected token (11:16)

./src/components/first-time-tab/player-setup.jsx

Module build failed: SyntaxError: C:/workspace/fasg-sports-dashboard/src/components/first-time-tab/player-setup.jsx: Unexpected token (11:16)

   9 |     renderAccountTabContent() {
  10 |             return (
> 11 |                 let sportsStartDate = this.props.playerInfo.sportsStartDate;

Upvotes: 1

Views: 253

Answers (1)

rfornal
rfornal

Reputation: 5122

In your error, it shows you trying to return a variable assignment, not code. Put this line outside the return.

Try this ...

renderAccountTabContent() {
        let sportsStartDate = this.props.playerInfo.sportsStartDate;
        let renderData;

        let now = moment().format('YYYY-MM-DD');
        let past1Days = moment().subtract(1, 'days').format('YYYY-MM-DD');
        let past2Days = moment().subtract(2, 'days').format('YYYY-MM-DD');
        let past3Days = moment().subtract(3, 'days').format('YYYY-MM-DD');

        if(sportsStartDate && sportsStartDate === now) {
            renderData = 'We’re setting up your player and verifying the funds you’ve deposited. Don’t worry — it might take a couple of days for your player to reflect your balance.';
        } else if(sportsStartDate && sportsStartDate === past1Days) {
            renderData = "We’re setting up your player and verifying the funds you’ve deposited. Don’t worry — it might take a couple of days for your player to reflect your balance.";
        } else if(sportsStartDate && sportsStartDate === past2Days) {
            renderData = "We’re making some progress. See what’s happening today.";
        } else if(sportsStartDate && sportsStartDate === past3Days) {
            renderData = "We’ve put your money to work in your investment player.See what’s happening today.";
        } else {
            renderData = "Your new portfolio is a work in progress. See what’s happening today.";
        }

        return (
            renderData
        );
}

Upvotes: 1

Related Questions